Repository navigation
feat: read a thread an author writes as replies to themselves in order - #449
Conversation
|
@camilleislasse can you limit the initially shown followups to 3 self-replies (so it doesn't clutter the Log if someone does 10 replies)? And then every "Show more" could show up to +10 messages. Other than this, LGTM, will merge after the change. |
Just to be sure: in the log, threads aren’t unrolled, only a “Show thread” link. Did you mean the commit page? If so, I’ll show the first 3 there and load 10 more on each “Show more”. |
Ah, I meant the log, my bad. On the commit page which is scoped to one commit anyway, you can show 10 at once, that's fine. |
41c938c to
54db3a9
Compare
|
Thanks! |

Closes #403. Thanks to @xHeaven for suggesting the
k/nmarkers and loading long threads a page at a time.When someone writes a thread by replying to themselves, the next parts are folded under "N replies", mixed with everyone else's replies and indented one level deeper each time. This only changes how those existing self-reply chains are shown: no new column and no new way to post.
Behavior
3/7, with a+when more than 100 parts follow. Each part keeps its other replies folded under it.ShowThreadLinkand its two call sites) and can be dropped on its own; without it, those cards would just show one reply fewer, with nothing pointing to the rest of the thread.How it works
CommitBuilder::withContinuationId()selects the author's earliest reply to their own commit ascontinuation_idwhen the viewer may see it, and leaves it out ofreplies_countwhen that count is loaded.CommitContinuationQueryfollows the chain with a recursive CTE (and a second one, walking up, for the position), then appliesvisibleTo()and cuts it at the first commit the viewer can't see, the wayCommitAncestorsQuerydoes. It loads the first 10 as cards, andGET commits/{commit}/continuationserves the next pages.exceptso a part's next part isn't listed among its replies.commits (parent_id, user_id, created_at, id)keeps each step to one index lookup.Limitations
+), and the position walk at 1,000 parts above it.CONCURRENTLY, so writes tocommitswait while it builds.Test changes
Two existing tests changed, because the reply they used was written by the commit's own author, which now makes it the next part of a thread:
BookmarkControllerTest: the saved reply is now asserted incontinuation.data.0instead ofreplies.data.0.UserControllerTest("only shows top-level commits on profiles"): the reply is now written by someone else, so it still counts towardreplies_count. A new test right after it covers the self-reply case.Media
Dark mode, fake demo data. On the commit page, all replies are expanded.
Commit page
Log