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.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime