Skip to content

fix(threads): keep inline response forms in the thread view - #943

Merged
tkuhn merged 1 commit into
masterfrom
fix/937-938-inline-forms
Nov 23, 2026
Merged

tkuhn merged 1 commit into
masterfrom
fix/937-938-inline-forms

Conversation

@tkuhn

@tkuhn tkuhn commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Closes #937, closes #938.

Why

The response forms that open inside a thread view were submitted as a plain page POST. The page that comes back rebuilds its views, so the form disappeared together with what had been typed into it and any message saying why it was not published. To the user, publishing silently failed (#937). The forms also opened for visitors who were not logged in.

What changes

In the thread view

  • Login first: a response action (reply, support, …) asks a logged-out visitor to log in, then opens the full publish form, as other publish links do.

  • Submitted in place: the inline form submits over AJAX. If the nanopub is not published, the form shows again in place, with its input and the reason.

  • Inline preview: Preview shows the nanopub inside the box, with consent, Publish and Back. Back returns to the form as it was. Publishing from there uses the preview page's code, now PreviewPage.publishPreviewed.

  • A box of its own (Nicer inline forms #938): headed by the action and what it responds to ("reply in response to “…”"), with a × to close it.

  • One form at a time: opening a form closes any other open one. Only the cards involved are redrawn.

  • Asks before discarding: once something has been typed into a form, or it was previewed, these ask "Discard the response you started writing?" first:

    • closing it (× or the action again)
    • opening another form
    • folding its branch
    • "load more" where it would rebuild that form

    Leaving the page triggers the browser's own prompt, except while publishing.

  • Background refreshes: a view with an open form is not replaced while it refreshes.

On the publish page

  • A Preview that could not be made, for example because a newer version appeared or an identifier is already in use, no longer goes on to publish. That publish attempt failed again on the same check and showed the message twice.
  • Otherwise /publish and /preview work as before: a normal page submit, the same checks in the same order. PublishForm's existing 4-argument constructor keeps this behaviour; the inline mode is a new 5-argument one.

Testing

Run locally in headless Chrome against the thread view of the nanoarguments pilot space, logged in, using only Preview:

  • an empty required field gives its message inside the box
  • Preview shows inline, and Back keeps the text
  • switching forms asks: Cancel keeps the form, OK switches
  • a form with nothing typed switches without asking
  • × asks
  • the leave-page prompt appears
  • no browser errors

Logged out, a response action goes to the login with no form opened. On /publish, Preview → /preview → Back still keeps the text.

Not tried: clicking Publish itself, from the inline form or from the inline preview. To try: Publish with consent unticked should leave the message in the box, and a real reply should land on the space page.

ThreadNodePanelTest passes, including "load more". PublishFormTemplate*Test and PreviewPageProtectedTest intermittently fail to fetch templates from the registries. Each passed in at least one of three runs.

🤖 Generated with Claude Code

The response forms that open inside a thread view were submitted as a
plain page POST. The page that comes back rebuilds its views, so the
form went away together with what had been typed into it and any
message saying why it was not published: publishing looked like it
silently failed. The forms also opened for visitors who were not logged
in, who could never publish from them.

- A response action asks to log in first, and then opens the full
  publish form, as the other publish links do.
- An inline form submits over AJAX. If it is not published, it shows
  again in place, with its input and the reason. Its preview is shown
  inside the box too, with Publish and Back; Back returns to the form
  as it was. Publishing from there shares the code of the preview page
  (PreviewPage.publishPreviewed).
- The form is a box of its own, headed by what is being published and
  what it responds to, with a close cross.
- At most one form is open on a page: opening one closes the others.
  Once something has been typed into a form, or it was previewed,
  closing it, opening another, folding its branch or loading more
  responses around it asks first, and so does leaving the page. Views
  that refresh in the background leave a view with an open form alone.

On the publish page, a preview that could not be made no longer goes on
to publish, which failed again on the same check and showed its message
twice.

Closes #937
Closes #938

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tkuhn
tkuhn merged commit 775773c into master Nov 23, 2026
8 checks passed
@tkuhn
tkuhn deleted the fix/937-938-inline-forms branch November 23, 2026 12:30
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.23.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nicer inline forms Inline forms don't check whether user is logged in

1 participant