تأخر هذا الأمر كثيرًا بسبب الكثير من التغييرات في المنطقة المتأثرة في نفس الوقت الذي كان يعمل فيه. أصبحت طلبات السحب (PRs) هذه قديمة جدًا بحيث لا يمكن إحياؤها — ولاحظت أيضًا أن تأخير هذا الأمر كان بفعلِي أنا، لأنني كنت الشخص الذي يقوم بكل التغييرات في تلك المنطقة. لذلك، توليت هذا الأمر وقمت بدمج إصلاح للتغيير.
main ← fix-stranded-notifications-revoked-access
merged 05:50PM - 12 Aug 26 UTC
The notification list Guardian-filters inaccessible topics, but the unread-badge… counter (raw SQL COUNT) does not. When a user lost PM access, stale notification rows kept inflating the badge — the menu showed nothing new, but the count wouldn't clear.
Discourse already has `Jobs::DeleteInaccessibleNotifications` (used by `TopicConverter` and `PostMover`). This PR:
- Wires it into `Topic#remove_allowed_user` (inline, Guardian-guarded so users with group-based access are preserved), `Topic#remove_allowed_group`, and `GroupManager#remove/bulk_remove`.
- Narrows the `GroupManager` enqueue to topics where removed users actually have notifications, and passes `user_ids` so the job scopes its work — prevents fan-out when a large group sits on many PMs.
- Rewrites the job: Guardian-check once per user (not per notification), single batched `delete_all`, one publish_notifications_state` per user.
- Adds a post-deploy backfill migration to clean up existing orphaned PM notifications.
Category-permission, trust-level, and direct `GroupUser#destroy` paths (SSO, auto-groups) are left as follow-ups.
[`/t/311995`](https://meta.discourse.org/t/cant-clear-unread-notification-after-being-removed-from-a-pm/311995)
[`/t/384961`](https://meta.discourse.org/t/sticky-unread-reply-notification/384961)
أعتقد أن هذا صحيح، وأنا أيضًا غير متأكد مما إذا كان لا يزال معطلًا حاليًا. بأي حال، يجب بالتأكيد قد يتم إصلاحه بعد هذا الدمج.
إعجابَين (2)