Skip to content

Let members watch an article and be told when a new version goes live - #38

Merged
bonelifer merged 2 commits into
mainfrom
feature/watch
Oct 12, 2026
Merged

bonelifer merged 2 commits into
mainfrom
feature/watch

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

What this does

Adds the "Watch/subscribe to an article" item from docs/TODO.md. Until now the only wiki notification went to moderators when an edit awaited approval; a reader had no way to ask to be told when a particular article changes.

  • Watch button. A bell button in the article's button row, for signed-in members who may view the wiki, toggles between Watch article and Stop watching. The link carries a link hash, so a forged link is refused.
  • Notification. When a new version of a watched article goes live, whether a moderator approved an edit or a trusted editor's edit went live directly, each watcher is told: "A new version of the wiki article X is now live." The member who saved that version is never told about their own edit, and a watcher who may no longer view the wiki is skipped. It is a new notification type, "A wiki article you watch has a new version", so members choose the bell, email or both under Notification settings, and there is a matching email template (English and German).
  • Automatic watching. A new ACP setting, Watch edited articles under Extensions > Wiki > Settings, is on by default: saving an edit also starts watching that article, and the same button stops it. Turning it off stops adding watches; existing ones stay.
  • Housekeeping. Watches are stored in a new wiki_watch table, added by a migration along with the setting. They are removed when the article is deleted and when the member is deleted (core.delete_user_after).
  • The existing "awaiting approval" notification type had no English label in the notification settings (only German); it has one now.
  • German strings, a README paragraph, and removal of the TODO entry.

Testing

Claude ran two browser scripts on a phpBB 4.0 (master) board seeded with the wiki fixtures, and the first one again on fresh phpBB 3.3.19 boards with MySQL 8.0 and with PostgreSQL 16 (13 checks each, passing):

  • a guest sees no button; a signed-in reader sees Watch article, it flips to Stop watching, and stopping removes the row; a watch link without the hash is refused;
  • a moderator approves a pending version of a watched article: the watcher gets exactly one notification, with the expected text in their notification list, and the moderator gets none;
  • saving an edit auto-watches; a live edit by someone else then notifies that editor; with the ACP setting off an edit does not watch, and on it does;
  • deleting the article removes its watches; deleting a member (with the phpBB CLI) removes theirs, checked on SQLite, MySQL and PostgreSQL;
  • the notification settings page names the new type in words, not as a language key.

Ten new unit tests cover who may watch (guest, bot, member, a member who cannot view the wiki), the notification type, and that both languages have the notification's words and the email template. All 87 wiki unit tests pass, and the new and changed PHP files lint clean on PHP 8.5. The email itself was not sent: the test boards have outgoing email off, so only the template's placeholders were checked.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

bonelifer and others added 2 commits October 12, 2026 13:25
A Watch article button for signed-in members, a wiki_watch table, and a
notification type that tells watchers when a version of the article goes
live, whether a moderator approved it or a trusted editor's edit went live
directly. The editor is never told about their own edit. With the new ACP
setting Watch edited articles (on by default) saving an edit also watches
the article. Watches are removed with the article and with the member.
The existing awaiting-approval notification type also gets its English
label.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The code sniffer (PSR2.Files.EndFileNewline) found two newlines at the end
of event/listener.php.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bonelifer

Copy link
Copy Markdown
Contributor Author

CI failed on the code sniffer: event/listener.php ended with two newlines instead of one (PSR2.Files.EndFileNewline). The method added for deleting a member's watches left the extra line. f946dad removes it; no other file was affected, and no behaviour changes. Because the sniffer step failed first, the rest of the matrix did not run, so this push re-runs the full set.


Investigated and written by Claude on behalf of William Jacoby (bonelifer).

@bonelifer
bonelifer merged commit afeaa80 into main Oct 12, 2026
58 checks passed
@bonelifer
bonelifer deleted the feature/watch branch October 12, 2026 19:13
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