As a participant, I want to write a new comment on a document and publish it under my name, so that I can start a conversation about what I just read.
Situation
I am reading a document and have something to say about it. I have an identity on this phone, and it is the one currently selected in Me.
What I do
Scroll to "Discussion" at the end of the document and tap "Add a comment".
Check the line that says who I am commenting as.
Type my comment.
Tap "Post".
Read my comment in the thread that opens.
What I should see
A sheet titled "New comment" rises over the document, with "Cancel" on the left and "Post" on the right. See the Compose sheet.
A grey line reads "Commenting as Name", using my profile name, or my key's name, or a shortened ID when I have neither.
The writing area fills the sheet and shows the hint "Write a comment…".
"Post" is dimmed until I have typed something other than spaces.
While the comment is being published the button reads "Posting…" and cannot be tapped again.
When it is published the sheet closes and the new Thread opens, with my comment as the first comment and "No replies yet." under it.
The phone gives a short success tap.
The reply field is ready at the bottom of the thread for a follow-up.
Going back to the document, the count and the thread list include my comment.
The comment is published to the site whose document I am reading, signed on this phone with my identity.
"Cancel", or dragging the sheet down, closes it and keeps what I typed for next time.
When something goes wrong
If publishing fails, the sheet stays open, my text is kept, and a red line says why: "The server refused the comment (409): …", "The document could not be loaded to comment on.", "Couldn't reach the server." or "This identity’s key is not on this device." I fix the cause, or simply tap "Post" again.
Not included
A comment is one plain paragraph: no formatting, pictures, attachments or quoting a passage of the document (Current limits).
My comment does not appear until the server has accepted it.
Comments cannot be edited or deleted in the app.
The unsent text is one draft for the whole app, so it also shows when I open the sheet on another document (Compose sheet).
There is no "Add a comment" in All comments.
Trace
Story US-DISC-03, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.
Design
Page | Part it plays |
|---|---|
The sheet where the comment is written | |
Where "Add a comment" lives | |
Where posting lands | |
The "Add a comment" pill | |
The posted comment as the thread root | |
The borderless textarea | |
The sheet bar with Cancel, title and Post | |
Cancel and Post | |
Why a first comment gets a sheet and a reply gets a pinned field | |
The compose sheet compared with the other composers | |
The success haptic and the "Posting…" label | |
Cancel leading, the confirming action trailing | |
The Cancel and Post bar buttons | |
Error line above the field, draft kept | |
The compose sheet as a modal | |
The comment goes to the site being read | |
"Commenting as Name" | |
Failure says why and keeps the text | |
Exact button and error wording |
Implementation
Page | Part it plays |
|---|---|
postComment: checks, signing, PublishBlobs, the returned thread link | |
DiscussComposeScreen | |
discussComposeDraft, discussAccountName, discussPosted and discussAfterPost | |
forget drops the document listing after a post; the thread fallback for a fresh comment | |
paragraphContent and threadHref | |
The signed Comment blob and its record id | |
Ed25519 principal and signing | |
Comment bytes match the original client | |
signerFor: the key that signs, read from the Keychain | |
POST /api/PublishBlobs with DAG-CBOR | |
Resource for the document version | |
The discussPosted mutation and what it refreshes | |
The compose route as a sheet; back then go to the new thread | |
How the mutation source receives the secret store | |
Network and secret-store grants the post needs | |
The write test against dev.hyper.media with a throwaway key | |
Post refusals and version handling | |
Single plain paragraph, no optimistic insert |
Code
File | What |
|---|---|
DiscussComposeScreen | |
the "Add a comment" pill | |
pkg:discuss declarations (drafts, discussAccountName, discussPosted) | |
discussEditCompose, discussPost, discussAfterPost, discussCancelCompose | |
pkg:discuss routes | |
postComment | |
paragraphContent | |
discussPost source | |
createComment | |
signerFor | |
Checks that text annotations do not overlap illegally |
Tests
File | What it checks |
|---|---|
discuss: post a comment and replies on dev.hyper.media with a throwaway key | |
a corrupt signing key returns a safe mutation refusal rather than throwing its secret | |
comment N: exact body, signature, CID and timestamp record ID |
Delivery
Delivered by #1470.
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime