Skip to content

[3.0] Tells members watching a topic when it is removed - #9749

Merged
jdarwood007 merged 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/topic-removed-notice
Oct 31, 2026
Merged

jdarwood007 merged 2 commits into
SimpleMachines:release-3.0from
albertlast:3.0/topic-removed-notice

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

Removing a topic (TopicRemove, or quick moderation's remove) calls Mail::sendNotifications($topic, 'remove') first and then Topic::remove(). The first only queues a CreatePost_Notify task; it does not send anything. Topic::remove() deletes the topic's rows from log_notify, and when the task runs, log_notify is exactly where it looks for the topic's watchers. It never finds anyone, so notification_remove ("A topic you are watching has been removed.") reaches nobody. This has been so since notifications moved into background tasks; 2.1 has the same order.

sendNotifications() still runs while the watchers can be found. For a removal it now records them in the task data, with their sent flags and the topic's starter and last poster, which the task uses when filtering. When the task gets that list, it loads those members directly instead of joining log_notify. Every other kind of notification is unchanged.

Testing

tests/Integration/Http/TopicRemovedNotificationTest.php:

  1. Posts a topic as admin and has a member watch it by email.
  2. Removes the topic from its page, the way the remove button does.
  3. Runs cron.php with the mail queue held.

The member must have "A topic you are watching has been removed." waiting in the queue. Without the fix nothing is queued. Checked on MySQL and PostgreSQL.

Issues References (Fixes|Related|Closes)

🤖 Generated with Claude Code

The "topic removed" notice is queued before the topic is removed, but
removing it also deletes the topic's log_notify rows, and the task only
looked for watchers there once it ran. It never found anyone, so the
notice has not reached anybody since notifications moved into
background tasks.

Mail::sendNotifications() now writes down who was watching a topic
being removed, and the task notifies them from that list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Adds the license header to the test file this adds, and writes the
docblock of each new test method in the agreed shape: Expected:, Guards:
for a regression, and @link lines for the commit that introduced the bug
and for this pull request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007
jdarwood007 merged commit f831136 into SimpleMachines:release-3.0 Oct 31, 2026
13 checks passed
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants