mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Only list watching group messages in messages notifications panel (#20630)
Why is this change required? Prior to this change, we would list all group messages that a user has access to in the user menu messages notifications panel dropdown. However, this did not respect the topic's notification level setting and group messages which the user has set to 'normal' notification level were being displayed What does this commit do? With this commit, we no longer display all group messages that a user has access to. Instead, we only display group messages that a user is watching in the user menu messages notifications panel dropdown. Internal Ref: /t/94392
This commit is contained in:
committed by
GitHub
parent
44bc284e0f
commit
e4b11e7643
@@ -1842,16 +1842,21 @@ class UsersController < ApplicationController
|
||||
if unread_notifications.size < USER_MENU_LIST_LIMIT
|
||||
exclude_topic_ids = unread_notifications.filter_map(&:topic_id).uniq
|
||||
limit = USER_MENU_LIST_LIMIT - unread_notifications.size
|
||||
|
||||
messages_list =
|
||||
TopicQuery
|
||||
.new(current_user, per_page: limit)
|
||||
.list_private_messages_direct_and_groups(current_user) do |query|
|
||||
.list_private_messages_direct_and_groups(
|
||||
current_user,
|
||||
groups_messages_notification_level: :watching,
|
||||
) do |query|
|
||||
if exclude_topic_ids.present?
|
||||
query.where("topics.id NOT IN (?)", exclude_topic_ids)
|
||||
else
|
||||
query
|
||||
end
|
||||
end
|
||||
|
||||
read_notifications =
|
||||
Notification
|
||||
.for_user_menu(current_user.id, limit: limit)
|
||||
|
||||
Reference in New Issue
Block a user