Skip to content

Per-topic prompt: Statement/Checklist modes, frequency, TL cap#18

Merged
Shalom-Karr merged 3 commits into
masterfrom
feat/prompt-checklist-modes
May 19, 2026
Merged

Per-topic prompt: Statement/Checklist modes, frequency, TL cap#18
Shalom-Karr merged 3 commits into
masterfrom
feat/prompt-checklist-modes

Conversation

@Shalom-Karr

Copy link
Copy Markdown
Owner

Summary

Extend the per-topic Prompt Checklist (PR #17) with three new knobs and
migrate the legacy per-topic before-reply prompt out of the Moderator
Actions modal.

New per-topic config fields

  • modestatement (single Markdown-cooked message + accept button)
    or checklist (the existing multi-item flow). Statement mode replaces
    the legacy per-topic before-reply prompt as the supported way to set it.
  • frequencyonce (default — per-user version-tracked acceptance)
    or every_reply (always prompt; no acceptance recorded).
  • max_tl — 0-4 trust-level cap, mirroring the global checklist's
    max_tl. Staff always see the prompt regardless of cap. Targeted
    checklists still take priority.

Editor (Prompt Checklist modal)

  • Discourse combo-boxes for Mode, Frequency, and max_tl.
  • A textarea for the statement text (Statement mode only).
  • Existing item rows + add/remove (Checklist mode only).
  • Existing button-label and save/clear buttons.

User-facing modal

mod-first-post-checklist renders both modes:

  • Statement — Markdown-cooked message + a single accept button that
    is enabled immediately.
  • Checklist — existing behaviour (items + checkboxes + accept when
    all ticked).

Removed from "Moderator Actions"

The legacy Before-reply prompt textarea + audience combo-box are
gone from mod-topic-messages-modal. Staff now configure the per-topic
prompt exclusively through the dedicated Prompt Checklist entry.

Legacy migration

The legacy mod_topic_reply_prompt and mod_topic_reply_prompt_max_tl
topic custom fields stay registered. When the Prompt Checklist editor
loads for a topic that still has the legacy reply prompt set (and no
new prompt-checklist config), the editor pre-fills itself in Statement
mode with the legacy text and the legacy mod_topic_reply_prompt_max_tl
as max_tl, and shows a migration notice. Saving the new config writes
the new structure AND clears the two legacy fields, so the new flow is
the sole source of truth from then on. Any unmigrated topic continues
to use the legacy composer gate.

Tests + docs

  • Extended spec/requests/topic_prompt_checklist_spec.rb (statement
    mode payloads, frequency: every_reply always returns, max_tl cap
    filters non-staff above the cap, legacy pre-fill + migration).
  • Extended spec/system/topic_prompt_checklist_spec.rb (statement-mode
    modal renders without checkboxes; every_reply re-prompts on the
    second reply; max_tl=1 skips a TL2 user; Moderator Actions modal
    no longer carries the Before-reply prompt section). Screenshots
    181–186.
  • Reworked the system tests that filled the now-removed .mod-reply-input
    / .mod-reply-audience-input selectors to either use the new Prompt
    Checklist modal or assert the legacy section is gone.
  • Updated docs/topic-prompt-checklist.md, docs/topic-reply-prompt.md
    (marked superseded with migration notes), docs/features.md,
    README.md, docs/testing.md, and CHANGELOG.md.

🤖 Generated with Claude Code

Shalom-Karr and others added 3 commits May 19, 2026 19:34
Extend the per-topic Prompt Checklist with three new knobs and migrate
the legacy per-topic before-reply prompt out of the Moderator Actions
modal:

- mode: "statement" (single Markdown-cooked message + accept button —
  replaces the legacy per-topic reply prompt) or "checklist" (existing
  multi-item flow).
- frequency: "once" (default — per-user version-tracked acceptance) or
  "every_reply" (always prompt; no acceptance recorded).
- max_tl: 0-4 trust-level cap, mirroring the global checklist; staff
  always see the prompt regardless of cap.

The user-facing modal now renders both modes. The Moderator Actions
modal no longer shows the Before-reply prompt textarea or audience
combo-box; the per-topic prompt lives exclusively under the dedicated
Prompt Checklist editor.

Legacy migration: opening the Prompt Checklist editor on a topic that
still has mod_topic_reply_prompt set (and no new prompt-checklist
config) pre-fills the editor in Statement mode with the legacy text
and legacy mod_topic_reply_prompt_max_tl as the new max_tl, with a
notice. Saving writes the new config and clears the two legacy custom
fields. The legacy fields remain registered and the legacy gate still
runs for any unmigrated topic.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Two follow-ups from CI:

- firstPostChecklistFor treated an empty items[] as inactive, which is
  the right behaviour for checklist mode but skipped statement mode
  (where items is empty by design). Branch on the mode: statement mode
  is gated when statement is non-blank, other modes still require at
  least one item. Adds unit tests covering both branches.

- The gallery_expansion tests that exercise the statement-mode editor
  now first switch the mode combo-box to "statement" before filling the
  textarea; the editor defaults to checklist mode for a topic with no
  existing config.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds two specs that cover the statement-mode flow more directly:

- A request spec asserts that the owed_checklist_for helper returns
  the full payload — kind/id/version/mode/statement/items/button_label/
  updated_at — when only a non-blank statement is set (items: []).
  Catches a regression where the owed gate treated armed strictly as
  items.length > 0.

- A system spec drives the full editor-to-user round trip: staff open
  the per-topic Prompt Checklist editor, switch the Mode combo-box to
  Statement, type the statement, save, then a user replies. The
  user-facing modal opens with the statement rendered, no checkboxes,
  and the accept button enabled immediately; accepting posts the
  reply.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Shalom-Karr
Shalom-Karr merged commit 62b33d9 into master May 19, 2026
4 checks passed
@Shalom-Karr
Shalom-Karr deleted the feat/prompt-checklist-modes branch May 19, 2026 23:59
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.

1 participant