Add group dropdown to post filter dialog (#16) #17

Open
ocbot426786 wants to merge 1 commit from ocbot426786/feet:feature/group-filter-dropdown into master
First-time contributor

What?

Closes #16 — "Dropdown to select group": allow the user to only view posts in a specific Fever group.

The app already requests and caches groups (?groups) together with the feeds_groups mapping during refresh, but nothing in the UI ever used that data. The only way to narrow down posts was the feed check-list, so a user could not filter by a whole group.

This change exposes the groups in the existing filter dialog as a dropdown:

  • All groups (default) — behaves exactly like before.
  • Any Fever group — the feed check-list is restricted to that group's feeds and they are pre-selected; pressing Done limits the Feed / Unread / Saved lists to that group.
  • The active group is shown in the app-bar menu entry (Filter (group: …)), and choosing All groups again clears it.
  • The filter is reset automatically on a full refresh, alongside the feed filter.

When a group is selected, the group filter and feed filter are combined (ANDed), so manually unchecking a feed inside a group also works.

Implementation

  • lib/api/cache.dart: new APICache.feedsInGroup(groupId) that resolves the feeds of a group from feeds_groups, skipping feed ids which are missing from the cache (defensive against deleted/not-yet-fetched feeds).
  • lib/widgets/filter_menu.dart: new DropdownButton<int?> at the top of the dialog listing "All groups" plus all cached groups (sorted by title); the feed list and summary text adapt to the selected group; the confirm callback now also returns the selected group id.
  • lib/main.dart: new _groupFilter state wired into the shared posts predicate for all three pages, the dialog invocation, the menu label, and the full-refresh reset.

Testing

flutter pub get
flutter analyze     # No issues found
flutter test        # All tests passed (8 tests: 2 existing + 6 new)

Added test/group_filter_test.dart:

  • Unit tests for APICache.feedsInGroup() (resolution, unknown group, stale feed ids).
  • Widget tests for the group dropdown (default all-groups state, selecting a group restricts/pre-selects the check-list and reports the group + feed ids, and opening with a group preselected).

Manual check on a device/emulator: open the popup menu → Filter..., pick a group in the dropdown, tap Done, and confirm only posts from that group's feeds are shown in all three tabs. I wasn't able to run the Android UI in this environment, so this part is only covered by the widget tests above.

Screenshots

The dropdown reuses the Material 3 styling of the existing filter dialog (a DropdownButton above the feed check-list), so no new visual language is introduced.

## What? Closes #16 — "Dropdown to select group": allow the user to only view posts in a specific Fever group. The app already requests and caches groups (`?groups`) together with the `feeds_groups` mapping during refresh, but nothing in the UI ever used that data. The only way to narrow down posts was the feed check-list, so a user could not filter by a whole group. This change exposes the groups in the existing filter dialog as a dropdown: - **All groups** (default) — behaves exactly like before. - Any Fever group — the feed check-list is restricted to that group's feeds and they are pre-selected; pressing **Done** limits the Feed / Unread / Saved lists to that group. - The active group is shown in the app-bar menu entry (`Filter (group: …)`), and choosing **All groups** again clears it. - The filter is reset automatically on a full refresh, alongside the feed filter. When a group is selected, the group filter and feed filter are combined (ANDed), so manually unchecking a feed inside a group also works. ## Implementation - `lib/api/cache.dart`: new `APICache.feedsInGroup(groupId)` that resolves the feeds of a group from `feeds_groups`, skipping feed ids which are missing from the cache (defensive against deleted/not-yet-fetched feeds). - `lib/widgets/filter_menu.dart`: new `DropdownButton<int?>` at the top of the dialog listing "All groups" plus all cached groups (sorted by title); the feed list and summary text adapt to the selected group; the confirm callback now also returns the selected group id. - `lib/main.dart`: new `_groupFilter` state wired into the shared `posts` predicate for all three pages, the dialog invocation, the menu label, and the full-refresh reset. ## Testing ``` flutter pub get flutter analyze # No issues found flutter test # All tests passed (8 tests: 2 existing + 6 new) ``` Added `test/group_filter_test.dart`: - Unit tests for `APICache.feedsInGroup()` (resolution, unknown group, stale feed ids). - Widget tests for the group dropdown (default all-groups state, selecting a group restricts/pre-selects the check-list and reports the group + feed ids, and opening with a group preselected). Manual check on a device/emulator: open the popup menu → **Filter...**, pick a group in the dropdown, tap **Done**, and confirm only posts from that group's feeds are shown in all three tabs. I wasn't able to run the Android UI in this environment, so this part is only covered by the widget tests above. ## Screenshots The dropdown reuses the Material 3 styling of the existing filter dialog (a `DropdownButton` above the feed check-list), so no new visual language is introduced.
ocbot426786 added 1 commit 2026-10-27 14:46:24 +00:00
Users can now restrict the Feed/Unread/Saved post lists to a specific
Fever group from the filter dialog. The app already fetched and cached
groups and feeds_groups, but nothing in the UI ever exposed them, so
posts could only be filtered by individually selected feeds.

- Add APICache.feedsInGroup() to resolve a group to the feeds that
  belong to it, skipping feed ids that no longer exist in the cache
- Add an "All groups"/group dropdown to FilterMenu; choosing a group
  limits the feed checklist to that group's feeds, and the dialog now
  reports the selected group together with the selected feeds
- Wire a new _groupFilter into the post filtering (ANDed with the feed
  filter), surface the active group in the app-bar entry, and reset it
  on a full refresh
- Cover the new behavior with unit tests for feedsInGroup() and widget
  tests for the group dropdown

Closes #16

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/group-filter-dropdown:ocbot426786-feature/group-filter-dropdown
git checkout ocbot426786-feature/group-filter-dropdown

Merge

Merge the changes and update on Forgejo.
git checkout master
git merge --no-ff ocbot426786-feature/group-filter-dropdown
git checkout master
git merge --ff-only ocbot426786-feature/group-filter-dropdown
git checkout ocbot426786-feature/group-filter-dropdown
git rebase master
git checkout master
git merge --no-ff ocbot426786-feature/group-filter-dropdown
git checkout master
git merge --squash ocbot426786-feature/group-filter-dropdown
git checkout master
git merge --ff-only ocbot426786-feature/group-filter-dropdown
git checkout master
git merge ocbot426786-feature/group-filter-dropdown
git push origin master
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Lea/feet#17
No description provided.