Skip to content

FEATURE: Reopen the wizard when a moderator asks to revise a queued topic - #338

Merged
angusmcleod merged 4 commits into
paviliondev:mainfrom
davidlippidinova:feature/revise-queued-wizard-topic
Nov 25, 2026
Merged

angusmcleod merged 4 commits into
paviliondev:mainfrom
davidlippidinova:feature/revise-queued-wizard-topic

Conversation

@sisti86dinova

Copy link
Copy Markdown
Contributor

When a wizard topic needs approval and a moderator chooses Revise in the review queue, core rejects the queued post and sends the author a message with the raw post, asking them to post it again. The topic never existed,
so there is nothing to edit, and posting the raw text with the composer loses the wizard's structure (category and tag fields, uploads, validations). In practice the author has to fill in the whole wizard again.

This PR handles Revise on queued wizard topics differently:

  • queue_topic stores the wizard id in the reviewable payload (next to wizard_custom_fields, which already holds the submission id).
  • When a moderator revises a queued wizard topic, CustomWizard::Submission.reopen copies the submitted answers into a new draft of the wizard.
  • Instead of the core message, the author receives a system message with the moderator's reason and feedback and a link to the wizard, which opens prefilled (text, composer, dropdown, category, tag and upload fields).
    Submitting it queues the corrected topic again.
  • It falls back to the core behaviour when the wizard can't be reopened: the wizard doesn't save submissions, doesn't allow multiple submissions, the user can't access it anymore, or the submission can't be found. Topics
    queued before this change (without the wizard id in the payload) are handled by looking the submission up across the user's wizard submissions.
  • Reject is unchanged.

The message is a new system_messages.custom_wizard_revise_queued_topic string (English and Italian).

Testing

  • New spec/extensions/reviewable_queued_post_spec.rb: prefilled draft and message, resubmission queues the corrected topic, lookup without the wizard id, fallback for single-submission wizards, other queued topics left to
    core.
  • Full plugin suite on Discourse 2026.11.0-latest: all green except spec/system/wizard_step_spec.rb, which needs Chromium (not available in my container).
  • Manually, with a 6-step production wizard (uploads, composer, category, tag, dropdown fields): queued as a non-staff user, revised, opened the link from the message, the wizard was prefilled, changed one field, submitted:
    the corrected topic was queued again with the same uploads, category and tags.

…opic

When a wizard topic needs approval and a moderator chooses "Revise", core
rejects it and sends the author the raw post, to be posted again with the
composer. That loses the wizard's structure, so the author has to fill the
whole wizard in again.

Instead, copy the submitted answers into a new draft of the wizard and send
a message with the moderator's reason and feedback and a link to the wizard,
which opens prefilled. Submitting it queues the corrected topic again.

Falls back to the core message when the wizard can't be reopened (e.g. it
doesn't allow multiple submissions or doesn't save submissions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@angusmcleod

Copy link
Copy Markdown
Member

When a wizard topic needs approval and a moderator chooses Revise in the review queue, core rejects the queued post and sends the author a message with the raw post, asking them to post it again. The topic never existed, so there is nothing to edit, and posting the raw text with the composer loses the wizard's structure (category and tag fields, uploads, validations). In practice the author has to fill in the whole wizard again.

I'm a little unclear why this is different from when a normal topic needs revision? I understand the user has created the topic in the wizard, but why do they need to edit it in the wizard? Also custom wizard topics have never been designed to work directly with the review queue, so this is a new feature. If you could describe the use case and need for this feature a bit more clearly. Thanks!

@sisti86dinova

Copy link
Copy Markdown
Contributor Author

Thanks Angus, fair question. Here's the concrete case.

The use case. We run a community where members publish structured "information documents" through a wizard: 7 steps, around 45 fields (text, dates, dropdowns, a checkbox list, several composer fields, 6 uploads), plus required category and tag fields. The create_topic action assembles all of this into the post through a post_template. The category requires approval, so every one of these topics goes through the review queue.

Why it differs from a normal topic. With a normal topic, the raw text in the revision message is what the author actually wrote, so they can fix it and post it again. With a wizard topic, the raw text is the output of the template, not the author's input. To revise it in the composer, the author would have to:

  • edit generated markup they never wrote (headings, lists and labels from the template), and keep that structure by hand;
  • choose the category and tags again, with nothing restricting them to the values the wizard allows;
  • re-attach the uploads;
  • skip every validation (required fields, formats, dates), so the revised topic can end up worse than the first one.

In practice our members don't post in that category with the composer at all: the wizard is the posting interface there. When a moderator asks for a small change, like a wrong date or a missing attachment, the author either rebuilds 45 fields from scratch or posts something that no longer matches the format. Both are bad outcomes, and moderators stop using Revise because of it.

What the PR does. When Revise is used on a queued topic that came from a wizard with multiple submissions enabled, the author's original answers are copied into a new draft of the wizard, and the system message links to /w/. The author fixes only what the moderator asked for, and the topic goes through the same action and validations as before. Every other case falls back to core behaviour, which stays unchanged.

I know the review queue wasn't part of the wizard's original design. That's partly why I kept the change small and limited to this one path. If you'd rather not change the default behaviour, I'm happy to put it behind a wizard-level or site setting (off by default). Either way works for us.

angusmcleod and others added 2 commits November 24, 2026 09:56
- Add the custom_wizard_reopen_on_revise site setting (off by default).
- Never overwrite a draft with answers; send the core message instead.
- Require the wizard id in the payload; drop the plugin store lookup.
- Use Dsa::AppealInstructions directly and Discourse.warn_exception.
- Test through the step endpoints so submissions are actually submitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Perform revise, approve and reject through the review endpoint, with
  and without DSA reporting.
- Fall back to the core message when reopening the wizard fails or the
  topic was posted as another user.
- Check upload, category, tag and composer fields are prefilled and
  resubmitted.
- Add a system spec for the whole flow, from the review queue to the
  corrected topic being queued again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@angusmcleod

Copy link
Copy Markdown
Member

Thanks for the explanation. I've made some updates. Let me know if those work for you and we can get this merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sisti86dinova

Copy link
Copy Markdown
Contributor Author

Thanks Angus, the changes work for us. I tested the updated branch locally: the full plugin suite passes, and so does the new system spec, which covers the whole flow from Revise in the review queue to the corrected topic being queued again. The opt-in setting and keeping an existing draft both make sense. We'll turn the setting on for our site. Happy for this to be merged.

@angusmcleod
angusmcleod merged commit 7a0bec9 into paviliondev:main Nov 25, 2026
6 checks passed
@sisti86dinova

Copy link
Copy Markdown
Contributor Author

Thanks Angus, we really appreciate it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants