Lilly
(Lillian )
7월 9, 2026, 5:27오전
7
자, 그냥 장난으로 - 위에서 언급한 옵션 B에 따라 모든 플래그 알림을 Moderators 그룹의 멤버에게만 보내도록 하는 PR을 여기에 열었습니다. 따라서 Moderators 그룹의 멤버가 아닌 Admins는 플래그에 대한 어떤 알림이나 표시도 받지 않게 됩니다. 물론 원할 때마다 사이드바를 통해 검토 대기열에 들어갈 수는 있습니다.
예상대로 일부 PR 테스트가 실패할 것 같고, 아마도 린팅 문제일 겁니다. ㅋㅋ
내 오래된 친구 triage-bot이 아마도 고쳐줄 거예요
main ← Lillinator:flags-notify-mods
closed 05:14PM - 09 Jul 26 UTC
## What is the purpose of this Pull Request?
Currently, Discourse broadcasts re… view queue notifications (flags, queued posts) to the entire `staff` group. This results in significant notification noise for "pure Admins" who are not members of the Moderator group, and thus, not involved in the day-to-day moderation of the community.
Following the discussion on Meta here: https://meta.discourse.org/t/add-setting-to-not-show-flag-notification-to-admins-who-are-not-moderators/383964/5
This PR makes flags only notify the Moderators group instead of staff; thus, Admins not in the moderators group are not notified of flags nor see a review queue count indicator in sidebar (they can still go to the review queue manually as usual). That is, it mutes the active UI elements for pure Admins while preserving their underlying permission to access and action the review queue if they choose to.
### Technical Implementation:
This PR intercepts the reviewable counts at the Model and Serializer layers to securely silence the frontend without modifying underlying database permissions or the core `/review` route.
1. **Websockets & Live Updates:**
* Scoped `notify_users` to `moderators` instead of `staff` to prevent live browser "pops" for admins.
* Updated `publish_reviewable_counts` to push `0` counts to pure admins.
2. **UI Badges & Preloaders:**
* Overrode `unseen_reviewable_count` and `reviewable_count` in `CurrentUserSerializer` to clear the red avatar flag, the blue menu badge, and the sidebar count for pure admins.
* Intercepted `Reviewable.user_menu_list_for` to return an empty array for non-moderators, effectively silencing the `<meta>` tag preloader and the user menu dropdown API.
3. **Tests:** Updated `refresh_users_reviewable_counts_spec` to expect `0` for admin payloads. *(Note: CI is running, will update any other strictly `staff`-scoped spec expectations as needed!)*
### Testing Performed:
Manually verified on a live development install with three distinct user roles:
- [x] **Pure Admin (Admin = true, Moderator = false):** Receives 0 websocket pops, no red avatar badge, no blue menu badge, and an empty menu dropdown. Can still successfully manually navigate to `/review` and action pending flags.
- [x] **Pure Moderator (Admin = false, Moderator = true):** Behavior remains exactly as it was. Fully receives websockets, badges, and dropdown items.
- [x] **Hybrid Staff (Admin = true, Moderator = true):** Behavior remains exactly as it was (receives all notifications).
- [ ] **Category Moderators:** not tested yet.
### Files Touched:
* app/models/reviewable.rb
* app/models/user.rb
* app/serializers/current_user_serializer.rb
* app/controllers/reviewables_controller.rb
* spec/jobs/refresh_users_reviewable_counts_spec.rb
* spec/requests/reviewables_controller_spec.rb
수정: 죄송합니다 @Moin , 카테고리 모더레이터는 신경 쓰지 않습니다
(이 PR이 어딘가에서 카테고리 모더레이터 알림을 깨뜨렸을 가능성이 있지만, 그건 또 다른 이야기입니다…)
4개의 좋아요