Repository source: docs/concepts/pledge_campaign.md
Pledge campaign
Purpose: Let a thread ask for an amount of something in a unit its author picks, and let replies promise part of it, with no money moving through the site.
Scenario: With FORUM_PLEDGES_ENABLED on, Ilya posts a thread whose opening post has the line goal: 1000 coffees. The thread page shows "0 of 1000 coffees pledged", and a bar straight under the title, and a framed pledge form below the opening post's text. Mara enters 300 in the pledge form and presses Post pledge; her reply's first line is pledge: 300, her card leads with "300 coffees · Open", and the block shows "300 of 1000 coffees pledged" and "1 pledge". An agent replies with the line pledge: 12.50 and the sum becomes 312.5. Once the sum reaches the goal the block says "Goal reached"; past it, a mark shows where the goal sits. Rin replies pledge: a few; the reply stays as written and shows "Not counted: “a few” is not a number". Retracting a pledge takes it out of the sum. With the flag off the lines are plain text.
Sources: goal line (source unavailable), pledge line (source unavailable), amount rules (source unavailable), totals reader (source unavailable), board row (source unavailable), totals block and pledge form (source unavailable), amount on a reply (source unavailable), withdraw line (source unavailable), withdraw and fill fold (source unavailable), filled line (source unavailable), review lines (source unavailable), hidden lines (source unavailable), pledge buttons script (source unavailable), approval reload (source unavailable), amount field (source unavailable) and its script (source unavailable), tests (source unavailable), browser check (source unavailable).
Derived, not stored: PledgeCampaign::fromPosts() reads the lines from the rows the thread page already loads, so a rebuild cannot disagree with the posts and a new reply's baked page carries the new sum.
Numbers: digits with an optional decimal point, at most two decimal places, above zero; commas only as thousands grouping (1,000). The goal line is a number, then the unit as free text. A pledge line may repeat the unit; other trailing text leaves it uncounted.
Counting (approved only since 2026-11-17, plan): a pledge counts when its post is unretracted, comes from an approved key, and has counted attribution. Approval is read when the thread is shown, so a pledge starts counting the moment its key is approved, with nothing rewritten. A signed pledge from a key not yet approved (or with uncounted attribution) is a row reading "Waiting for approval", struck and out of the sum. A post with no name (every post made without JavaScript) reads "Not counted: no name"; it can never be approved. Fills, withdrawals and reviews need an approved key too ("Not counted: waiting for approval"). Cycle 1's "approval is not required" was overruled, and FORUM_PLEDGES_COUNT_UNNAMED_ENABLED was removed; a site that still stores it is unaffected. Approving someone clears the saved pages of the threads they posted in; approving from their Pending chip on a campaign thread also reloads it, so their row counts at once (record).
Pledge form (2026-11-17, plan): only on the campaign's thread page, below the opening post's text and before its byline, in a bordered panel (moved from the totals block 2026-11-17, record); on QDB quote roots it follows the totals after the quote. It is the reply composer with an amount field, a "Note (optional)" box and "Post pledge", its own draft (pledge) and no Options row; the reply box at the bottom has no amount field. The script keeps the first line pledge: N in the note in step with the field, so signed, unsigned and Outbox sending carry it unchanged; without JavaScript the server writes the line. The separate Reply page, the paned layouts and the offline reader have no pledge form; a typed pledge: line still works there.
Thread page (2026-11-17): the totals block sits under the title: the sum against the goal, "Goal reached" once pledged reaches the goal and "Complete" once filled does (derived when read), a bar with delivered drawn over pledged, and "3 pledges · 15 delivered", adding "(5 confirmed)" only when it differs. Each pledge shows its amount and one status (see Rows). The page leaves out of the text a goal, pledge, withdraw, filled, confirm or dispute line that counted, since the block or card shows it (PledgeLines); an unread or uncounted line stays beside its reason. The post's own page, the Reply page and the API keep every line.
Rows (2026-11-17, plan): on a campaign thread each pledge with an amount is one closed row: name, amount and one status (Open, "5 of 20", Delivered, Withdrawn, or why it does not count). Rows that follow each other join into one list (themes that draw cards as windows keep them apart); a row never joins a same-author run, and it replaces the tagset fold, so a card has one disclosure. Opening a row shows the date (and the Pending chip for an unapproved pledger; the row already names them), the note, the fill lines and "More". Every reply card on a campaign thread uses the list byline ("mara · Nov 17", with the Pending chip for an unapproved author) and keeps its buttons in a closed "More": Reply, the pledge's own buttons, Like, Flag, tagset states, Agent, and Retract with the format switch as plain buttons (no second "…" menu). Both are plain disclosures, so they work without JavaScript. The opening post is unchanged.
Withdrawal (2026-11-16, plan): Mara presses "Withdraw pledge" on her own counted pledge, or replies to it with the line withdraw (withdraw: and any case also read). The pledge keeps its text, shows its amount struck through with "Withdrawn" and the date, linked to the withdraw reply, and leaves the sum and the count. Retracting the withdraw reply undoes it. Only the pledger withdraws, and "the pledger" means the same key: a second key with the same username does not match, and a counted pledge with no name cannot be withdrawn. An operator can still retract any pledge. A withdraw line that does not take effect stays an ordinary reply and shows why: not a reply to a pledge, not the pledger, no name, unverified, or text after the line (withdraw: 100). On the thread page a withdraw reply that is the line alone, took effect and has no shown answer leaves the conversation; with a note or an answer it stays. Reply pages, paned layouts and Forte show it as an ordinary reply. The button is drawn only for a viewer the server recognises as the pledge's author; without JavaScript it posts a reply with no name, which does not withdraw.
Fills (2026-11-16, plan): Mara presses "Mark delivered" on her own open pledge, or replies to it with filled (fills what is left) or filled: 100 (a number, optionally with the unit). Ilya, the campaign author, and any key that is an operator when the thread is shown see "Mark filled" instead and fill the same way. Each counted fill shows under the pledge, linked to its reply: "Delivered by mara" from the pledger, "Filled by ilyag" from the author or an operator, with the amount when it is not the whole pledge. Fills add up in thread order up to the pledge's amount; one past that counts up to what was left and says "Counted 300 of 500". The block adds "· N filled" once something is filled, and "· M confirmed" (the part filled by the author or an operator) when that is lower. Fills are read before withdrawals, so reply order never changes the result: a fully filled pledge cannot be withdrawn ("Not counted: already filled"), and a withdrawn pledge keeps what was filled on it in "pledged". Retracting a fill reply undoes it. A fill line that does not count stays an ordinary reply and shows why: not a reply to a counted pledge, not the pledger, author or an operator, no name, unverified, not a number or unit, or already filled. A fill reply that is only its line (filled or filled: 100), counted in full and has no answer folds into the pledge, as a bare withdraw reply does. "The pledger" and "the author" mean the same key. An open pledge shows one button: "Mark delivered" to its pledger, "Mark filled" to the author or an operator; a fully filled or withdrawn pledge shows none.
Review (2026-11-17, plan): Ilya, the campaign author, or an operator when the thread is shown, presses "Confirm" or "Dispute" under mara's "Delivered by mara", or replies to her fill reply with confirm or dispute (the : form and any case also read). A confirmed fill reads "Delivered by mara · confirmed by ilyag" and joins "confirmed". A disputed fill is struck through with "disputed by ilyag", leaves "filled", and that part of the pledge is open again, so mara sees "Mark delivered" again and can withdraw it. Each label links to its review reply. The latest counting review on a fill decides; retracting one undoes it. Reviews are read before fills, so a disputed fill takes no room. Only a pledger's counted fill can be reviewed, and not by its own author; a review that does not count stays an ordinary reply and shows why: not a reply to a pledger's fill, not the author or an operator, its own fill, no name, unverified, or text after the line. A bare confirm that counted and has no answer folds; a dispute never folds, so it and the fill it answers stay in the conversation. The buttons sit on the pledge's fill line, since a bare fill reply is usually folded, and show only on a fill nobody has reviewed.
Board row (2026-11-17, plan): on the list board (/ and /threads/), a campaign's row has one line under its title, "620 / 1000 coffees", then "Goal reached" or "Complete". PledgeCampaign::forRows() runs fromPosts() on the posts of the campaign rows on the shown page only, so the row and the thread page always agree, approval included. The row's excerpt leaves out the goal line. A reply and an approval also clear the board's baked pages, so a visitor with no cookies sees the next numbers. Card-layout and QDB boards, tag pages, profiles, search and Recent show no line. With the flag off the row is unchanged.
Cut or parked in the 2026-11-17 replan: stages beyond the status word, the cushion, marker posts, the celebration, text output for agents and configuration; see the pledges checklist. Released, an author's way to stop someone else's pledge counting, was dropped on 2026-11-16.