Skip to content

feat: read a thread an author writes as replies to themselves in order - #449

Merged
xHeaven merged 2 commits into
dev-null-sh:productionfrom
camilleislasse:feat/self-thread-page
Oct 18, 2026
Merged

xHeaven merged 2 commits into
dev-null-sh:productionfrom
camilleislasse:feat/self-thread-page

Conversation

@camilleislasse

Copy link
Copy Markdown
Contributor

Closes #403. Thanks to @xHeaven for suggesting the k/n markers 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

  • Commit page: the author's own replies follow the commit in order, flat, like the ancestors above it, 10 at a time with "Show more of this thread". Each part, and each ancestor in the thread, shows its place as 3/7, with a + when more than 100 parts follow. Each part keeps its other replies folded under it.
  • Counts and previews: the next part is left out of the reply count, the reply list and the newest-reply preview wherever a commit is shown (logs, profiles, Saved, search, nested replies, restored commits).
  • Show thread: elsewhere (logs, profiles, Saved, search and nested replies), a commit continued this way shows a gray "Show thread" link to its page. There's no count, since a thread's size isn't stored. The link is a small self-contained component (ShowThreadLink and 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.
  • The thread stops at the first reply the viewer can't see (deleted ones are skipped), and none of it shows if the viewer muted the author.

How it works

  • CommitBuilder::withContinuationId() selects the author's earliest reply to their own commit as continuation_id when the viewer may see it, and leaves it out of replies_count when that count is loaded.
  • CommitContinuationQuery follows the chain with a recursive CTE (and a second one, walking up, for the position), then applies visibleTo() and cuts it at the first commit the viewer can't see, the way CommitAncestorsQuery does. It loads the first 10 as cards, and GET commits/{commit}/continuation serves the next pages.
  • The replies endpoint takes an optional except so a part's next part isn't listed among its replies.
  • A partial index on commits (parent_id, user_id, created_at, id) keeps each step to one index lookup.

Limitations

  • The length is capped at 100 parts below the commit (hence the +), and the position walk at 1,000 parts above it.
  • The index is created without CONCURRENTLY, so writes to commits wait 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 in continuation.data.0 instead of replies.data.0.
  • UserControllerTest ("only shows top-level commits on profiles"): the reply is now written by someone else, so it still counts toward replies_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

Before After
Commit page before, desktop Commit page after, desktop
Commit page before, mobile Commit page after, mobile

Log

Before After
Log before, desktop Log after, desktop
Log before, mobile Log after, mobile

@xHeaven

xHeaven commented Oct 18, 2026

Copy link
Copy Markdown
Member

@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.

@camilleislasse

Copy link
Copy Markdown
Contributor Author

@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”.

@xHeaven

xHeaven commented Oct 18, 2026

Copy link
Copy Markdown
Member

@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.
My bad, in this case you can revert the last commit and I'll merge. Sorry :D

@camilleislasse

Copy link
Copy Markdown
Contributor Author
giphy

@xHeaven
xHeaven merged commit 7418b32 into dev-null-sh:production Oct 18, 2026
5 checks passed
@xHeaven

xHeaven commented Oct 18, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: read self-reply threads in order

2 participants