Skip to content

Introduce reply tree data model and update thread processing logic #1037

@joelmuraguri

Description

@joelmuraguri

Is your feature request related to a problem? Please describe.
Inside spinThread, any reply whose generation is non-consecutive with the current TimelineItem.Thread being built hits the else -> Unit branch and is silently discarded. This means if multiple users reply to the same post, only one reply chain survives and the rest are lost before the data ever reaches the ViewModel or PostDetailScreen. The codebase has no model capable of representing branching replies TimelineItem.Thread only holds a flat List<Post>.

Describe the solution you'd like

Two things land in this PR:

  • Define a ReplyNode data class where each node holds a Post, its threadGate, appliedLabels, its depth in the tree, and a List<ReplyNode> as its children. Introduce a TimelineItem.ReplyTree that holds the anchorPost and a List<ReplyNode> representing the root-level reply branches.
  • Rewrite spinThread to use parentPostUri from ThreadedPostEntity to group descendant posts by their parent and recursively build the full ReplyNode tree rather than a single flat chain. Posts with a negative generation (ancestors above the anchor post) remain as TimelineItem.Thread since that rendering is already correct and tested.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions