fix(stream): offer every account in the filter, not just the loaded ones - #2886
Open
karlitschek wants to merge 1 commit into
Open
fix(stream): offer every account in the filter, not just the loaded ones#2886karlitschek wants to merge 1 commit into
karlitschek wants to merge 1 commit into
Conversation
The stream's "filter by account" dropdown was built from the activities that
happened to be loaded, so it could only ever name people whose entries were
already on screen — precisely the ones a reader can see without filtering. An
account further down the stream, or one that had simply been quiet, could not
be picked at all.
The options now come from the stream itself, through a new
`GET /api/v2/activity/{filter}/actors`: the distinct authors of the viewer's
activities, resolved to display names. It deliberately takes no search term,
date range or actor, because this is the list a restriction is picked *from*,
and one that shrank to whatever is left in the current result could only
confirm what is already visible. The filter and object restrictions are
honoured, since those select a different stream rather than narrow this one.
The query rides the existing `activity_filter_by` index, is ordered by account
name and capped in SQL at 100 rows.
That covers everyone the stream knows about. For everyone else the picker now
searches as the reader types, through core's autocomplete endpoint rather than
a listing of this app's own, so the instance's account enumeration rules decide
who may be found here exactly as they do in every other account picker. Stream
accounts are offered first — those are the ones with activities behind them —
and a failed search leaves them in place instead of emptying the dropdown,
which would read as "nobody by that name".
Signed-off-by: Frank Karlitschek <karlitschek@users.noreply.github.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The stream's "filter by account" dropdown was populated from the activities that happened to be loaded, so it could only offer people whose entries were already on screen — exactly the ones a reader can see without filtering. Anyone further down the stream, or simply quiet lately, could not be picked, and typing their name found nothing because there was no search behind the control.
The fix
Stream accounts come from the stream, not from the page. New endpoint:
Data::getActors()selects the distinct authors of the viewer's activities through the sameapplyStreamConditions()the feed and the histogram use, so the list can never disagree with what the stream contains. It deliberately takes no search term, date range or actor — this is the list a restriction is picked from, and one that shrank to whatever is left in the current result could only confirm what is already visible. The filter and object restrictions are honoured, because those select a different stream rather than narrow this one.Cost: one indexed column read in account-name order, which is the existing
activity_filter_by (affecteduser, user, timestamp)index, capped in SQL at 100 rows so the database stops reading as soon as the cap is met. Display names are resolved throughIUserManager; deleted and non-local authors keep their account name as the label, since their activities are still in the stream and still filterable.Everyone else is found by typing. The picker now searches as the reader types, through core's
/core/autocomplete/getrather than an account listing of this app's own, so the instance's enumeration rules decide who may be found here exactly as in every other account picker. Stream accounts are listed first — those are the ones with activities behind them — results are deduplicated against them, and a failed search leaves them in place rather than emptying the dropdown, which would read as "nobody by that name". A picked search result keeps its display name after the results are dropped, and the control is no longer hidden when the stream itself reported no accounts.Notes
docs/endpoint-v2.mddocuments the new endpoint and why it has no search parameter.Tests
Data::getActors(): every author in the stream, deduplicated, other accounts' streams excluded, unaffected by activity age, authorless system events skipped, empty user rejected.APIv2Controller::getActors(): display-name resolution and sorting, fallback for accounts without one, half-given object ignored, unknown filter → 404, anonymous → 403.Verified against a real instance:
all,byandfocusedreturn 200; as a user whose stream holds four accounts, typing a fifth account's name finds them, picking them sets?actor=…and the stream reacts.