discuss.contract draws comments in four places: the section under a document, the list of all threads, a thread, and the compose sheet. Its data comes from two resources and one mutation declared in the root contract. As in read, plain testIds sit only on the visible screen (active).
Shapes and helpers
DiscussComment, Discussion, DiscussThread, DiscussReply (L7-L40) mirror CommentRow, Discussion, ThreadPage and PostReply in logic.ts and load.ts.
dtid(active, name): the testId only when active.
repliesText(n), commentsText(n): 1 reply, 3 replies, 1 comment, 3 comments.
whenText(at, now, utc): now, 5 min. ago, 3 hr. ago, 2 days ago within a week, then the medium date. now is the root's minute clock; 0 or a future instant reads absolute.
Components
Component | Props | Renders |
|---|---|---|
| Avatar, name, time ( | |
| A link to the thread: the bubble and the reply count. | |
| Under a document, through read's | |
| Every thread of a document, with pull to refresh. Finds its | |
| The reply bar of the thread screen. | |
| A thread and its composer. | |
| The modal sheet for a new top-level comment. |
TestIds tests rely on
Section: discussion, discussion-count, discussion-loading, discussion-error, discussion-empty, thread-{i} (first three), discussion-all (more than three threads), discussion-add.
All threads: all-title, all-loading, all-error, all-thread-{i}.
Thread: comment-thread, thread-title, thread-loading, thread-doc, thread-comment-{i}, thread-root, thread-reply-{i}, thread-root-when, reply-{i}, thread-count.
Composer: compose-need-identity, compose-create-identity, reply-to, reply-cancel, compose-error, reply-composer, reply-send.
Compose sheet: compose-cancel, compose-title, compose-post, compose-as, compose-error, compose-text.
Thread screen behaviour
The first comment is the root (big). Signed-in people get a Reply button under every reply; it calls setReply(c.id). The screen's local send action posts to page.ref with the parent being the chosen reply, or the root when none is chosen. The composer's send button keeps focus (retainFocus) and the screen sets interactive-widget="resizes-content" so the keyboard resizes it. Without an identity the composer shows Create an identity to reply. and a Create button.
Root contract wiring
The routes, state, the two resources, the discussPosted mutation and the actions that feed these components are listed in Discuss: root contract wiring.
Contract tests
discuss.test.contract has 6 tests. Reads use live https://hyper.media. "The one write test switches the server to https://dev.hyper.media and signs with a throwaway BIP39 test-vector key; it never posts to hyper.media."
A document with comments shows the summary, three threads and "See all".
A thread (by route) shows its root, two replies and the identity prompt.
A thread row opens the thread.
Composing without an identity leads to the create screen.
Post a comment, a reply, and a reply to the reply on dev.
Comment times are relative and follow the clock (24 min. ago, 1 hr. ago, 2 days ago, then Feb 26, 2025) without asking the server again.
open-site-activity.test.contract additionally checks that a reply from an Activity thread goes to the configured server, and that a refusal reads The server refused the comment (409): Reply received by local fixture. See Contract UI tests.
User stories
The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).
US-DISC-01 See the discussion on a document: DiscussSection, DiscussThreadRow and DiscussAllScreen
US-DISC-02 Read a thread: DiscussThreadScreen, DiscussBubble and whenText
US-DISC-03 Comment on a document: DiscussComposeScreen
US-DISC-04 Reply in a thread: DiscussThreadScreen send target and DiscussComposer
US-DISC-05 Be guided to create an identity before commenting: The signedIn branches of DiscussComposer, DiscussThreadScreen and DiscussComposeScreen
US-ACT-02 Open what a notification is about: The thread screen that opens
US-APP-07 Read clear, consistent wording: The reply composer and compose sheet
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime