Skip to content

Comment drafts - #2457

Merged
tf merged 5 commits into
codevise:masterfrom
tf:comment-drafts
Jul 31, 2026
Merged

Comment drafts#2457
tf merged 5 commits into
codevise:masterfrom
tf:comment-drafts

Conversation

@tf

@tf tf commented Jul 31, 2026

Copy link
Copy Markdown
Member

REDMINE-21261

tf added 5 commits July 31, 2026 12:34
Submitting the new thread form left the editor with no selection at
all, dropping the reviewer back to the outline. Wait for the thread to
be created instead and select the comments of its subject, highlighting
what was just written.

The thread id is only known once the create request has come back, so
ReviewSession emits a create:thread event the preview message
controller reacts to.
Dismissing a popover, changing the selection in the editor or leaving
the new thread view discarded whatever had been typed. Store the text as
a draft on the review session instead, keyed by subject alone: a draft
written about one phrase of a text block is offered again when
commenting on another phrase of the same block.

The session also represents the create request in flight as a pending
draft, which is what disables the form and shows a spinner. Submitting
therefore no longer closes the thread list form right away: it stays
open until the thread has been created, or becomes editable again with
the text still in it when the request failed.

Drafts reach the editor sidebar and the frontend popover through the
same message relay as the rest of the review state, except that the
sidebar writes them directly: its message handler is disposed together
with the view, which would drop the draft stored on the way out.
The chain of conditions had grown to five branches, one of them only
there to keep drafts from reopening a form the caller suppressed.

Everything that used to be the default at the end of the chain is the
initial value of the toggle state now, which also means resolving the
last thread of a subject no longer invites a new one.
Prepares drafting replies: keys the drafts of a session by thread when
one is given, and moves the hook holding a form's drafted text into a
module of its own so both comment forms can use it.
Replies now work like new threads: the text is stored as a draft when
the form goes away and restored when it comes back, and creating one
marks that draft pending, which disables the form and shows a spinner.

Two differences to the new thread form. A thread whose reply has been
drafted stays expanded, since collapsing hides the form the draft
belongs to. And the form outlives its submit, so it empties itself once
the session has dropped the draft the reply was created from.
@tf tf added this to the v17.2 milestone Jul 31, 2026
@tf
tf merged commit 972c359 into codevise:master Jul 31, 2026
18 checks passed
@tf
tf deleted the comment-drafts branch July 31, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant