A platform for community discussion. Free, open, simple.
FIX: do not send emails when channel-wide mentions are disabled in a channel (#20677)
Andrei Prigorshneve6c04e2dc20a
diff --git a/plugins/chat/lib/extensions/user_notifications_extension.rb b/plugins/chat/lib/extensions/user_notifications_extension.rbindex b64004c3a3b..93d3039d705 100644--- a/plugins/chat/lib/extensions/user_notifications_extension.rb+++ b/plugins/chat/lib/extensions/user_notifications_extension.rb@@ -10,7 +10,9 @@ module Chat::UserNotificationsExtension.joins(:user, :chat_channel).where.not(user: user).where("chat_messages.created_at > ?", 1.week.ago)- .joins("LEFT OUTER JOIN chat_mentions cm ON cm.chat_message_id = chat_messages.id")+ .joins(+ "LEFT OUTER JOIN chat_mentions cm ON cm.chat_message_id = chat_messages.id AND cm.notification_id IS NOT NULL",+ ).joins("INNER JOIN user_chat_channel_memberships uccm ON uccm.chat_channel_id = chat_channels.id",)