Resources and mutations may only be declared in the root component, so the data wiring for comments lives in the // >>> pkg:discuss blocks of app.contract (Package conventions and ownership blocks). The components that consume it are in Discuss: screens and components.
Routes and declarations
Routes (app.contract L34-L38): thread "/c/:uid/:comment", comments "/comments/:ref", compose "/compose/:ref".
Declarations (L107-L120):
Name | Meaning |
|---|---|
| Bumped by |
| The reply draft, the compose-sheet draft, the comment being answered. |
| Refs of every loaded document on the reader's server, plus the |
|
|
|
|
| The profile name, else the key name, else the short id. |
|
|
|
|
|
|
| The mutation's |
Actions (L328-L365):
Action | Effect |
|---|---|
|
|
|
|
| Update a draft. |
| Set |
| Picks the compose draft when |
| On |
| Back. |
| Resets the create form, asks for new recovery words and goes to |
The provide block supplies discussions, discussNow and discussUtc for injection, and the view switch renders the three screens.
Things to keep in mind
Both resources are asked on readContextServer, and the post goes there too, so a comment on a typed-site document is written to that site (Read: root contract wiring).
discussTargets includes only documents whose server equals readContextServer, so comments are not requested for covered documents from another site.
The post time is time.epochAtZero + performanceNow(), taken in the action. It becomes the Comment blob's timestamp (Discuss: loading and posting).
refreshes discussions, discussThreads re-asks both resources after a post; the module has already dropped the document's cached listing.
User stories
The code described here exists to deliver these stories. Each story lists this page in its Trace (traceability).
US-READ-06 Keep reading another site in place: discussTargets, discussions, threads and discussPost use readContextServer
US-READ-10 Refresh a page and recover from a failed load: discussEpoch + readEpoch: refreshing a document also refreshes its discussion
US-DISC-01 See the discussion on a document: discussTargets, the discussions resource, the provide block
US-DISC-02 Read a thread: discussThreadIds, the discussThreads resource, the minute clock
US-DISC-03 Comment on a document: discussComposeDraft, discussAccountName, discussPosted and discussAfterPost
US-DISC-04 Reply in a thread: discussDraft, discussReplyTo, discussSetReply focus, discussAfterPost
US-DISC-05 Be guided to create an identity before commenting: discussSignedIn and discussOpenCreate
US-VAULT-03 Lock my vault, switch to local, or log out: Signed-in state that turns off while no identity is available
US-APP-02 Move around the app without losing my place: Thread, comments and compose routes on the Read tab
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime