Repository navigation
feat: tell API clients which guild made a commit appear in Following - #1649
shanesmithdev wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
87affa5 to
90094ce
Compare
|
lgtm just needs a merge now! |
90094ce to
65c386c
Compare
|
Rebased recent commits from |
The signed Following log now gives each commit a joined_guild: the handle of the joined guild that brought that commit there, or null. This matches how the web's "because you joined" message works. Trending, Latest, suggestions and nested commits are unchanged.
65c386c to
58acc49
Compare
|
Sorry @paulinevos I didn't notice your comment approval until after I'd pushed a rebase, not sure if that undid anything. |
Summary
On the web, a commit that's in your Following log only because you joined a guild says "because you joined #handle". The signed API's Following log didn't carry that, so the apps couldn't have feature parity with that message.
Signed
GET api/v1/log/followingnow gives each commit indataajoined_guild: the guild's handle, or null. It has the same name and meaning as on the web. It's null for commits by you or by people and organizations you follow, and null when guilds aren't available to you.Trending, Latest, the suggestions on an empty Following log, and nested commits (reply previews, parents, quotes) don't change: they have no
joined_guildkey.Changes
Api/LogController::showcalls the web'sGuildCommitsQuery::joinedFor()on the same page, forLog::Followingonly. It sets the result on each commit withsetAttribute('joined_guild', …).CommitResourcesends it withwhenHas('joined_guild'), the wayApi/SuggestedUserControllerandUserResourcehandleis_followed. So the key only appears where the controller set it.ShownStreamsandShownCommitResourcealone because perf: paginate guild data without global preloads #1615 rewrites them. The one-lineCommitResourceaddition merges cleanly with perf: paginate guild data without global preloads #1615's version of it, and it still works with perf: paginate guild data without global preloads #1615'sGuildMentionCollection, which resolves each resource as before.joinedFor()runs a fixed few queries per page.guildis already eager-loaded on log commits, so there's no per-commit query. A new test locks that in for Following.Validation
Local only (macOS, PHP 8.5, Postgres 18 with pgvector and pg_trgm).
vendor/bin/pest tests/Feature/Controllers/Api/LogControllerTest.php: 27/27 on a cleanproductionbefore the change, 33/33 after. The new tests cover:joined_guildkey;composer test: passed. That's Pint, Rector, oxlint and formatting, PHPStan with 0 errors, TS types, 100% type coverage, Pest 6,493 passed with 100.0% line coverage, and the Bun unit tests, 1,106 passed.Independent review
I reviewed each line of code again before submitting the PR and stand by them.
I also had a separate review agent (with no part in the changes) had a look at it:
6d3a957013be5a7e75cf8e7b801acbee54f07800(upstreamproduction)90094cee5727b2e9e9a5c3701ac6eafa2284d8b2, the reviewed working-tree diff with sha256de713be257a401e37e762fde93e5c6964ac645e46c7fccefd5b7c5b2ecc8eeacCommitResourceand API log tests. It didn't run the full suite or exercise a real app client.Limitations
joinedFor()alone. The web's guild tests coverjoinedFor()directly.joined_guildyet. That's a separate change that I'll implement once this is merged.Summary by CodeRabbit
Summary by CodeRabbit