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 under the opening post. Mara enters 300 in the Pledge field above the reply box and posts; her reply's first line is pledge: 300, the reply shows "300 coffees", and the block shows "300 of 1000 coffees pledged · 1 pledge". An agent replies with the line pledge: 12.50 and the sum becomes 312.5. Once the sum passes the goal the bar is full and 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), totals block (source unavailable), amount on a reply (source unavailable), withdraw line (source unavailable), withdraw and fill fold (source unavailable), filled line (source unavailable), pledge buttons script (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: a pledge counts when its post is unretracted, names its author and has counted attribution. A post with no name (which includes every post made without JavaScript) and, while Verified attribution is on, an unverified post show their amount struck through with the reason, and stay out of the sum. Approval is not required. Every reader sees the same reason. With FORUM_PLEDGES_COUNT_UNNAMED_ENABLED ("Count pledges with no name", off by default, needs Pledges on) a post with no name counts like any other; unverified posts still do not.
Amount field: only on the campaign's thread page. The script keeps the first line pledge: N in the body 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 and the paned layouts show the lines as text and have no field.
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 bare fill reply that counted 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.
Not yet: confirm, dispute and Released (cycle 8), stages, board rows, text output for agents and configuration; see the pledges checklist.