Merge pull request #4811 from cpradio/update-auto-notification

FIX: Update auto_notification to also update the subscription state when replying if the current state is less than the state being requested
This commit is contained in:
Jeff Atwood 2017-04-14 12:50:49 -07:00 committed by GitHub
commit ecace5085c
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,8 @@ class TopicUser < ActiveRecord::Base
end
def auto_notification(user_id, topic_id, reason, notification_level)
if TopicUser.where(user_id: user_id, topic_id: topic_id, notifications_reason_id: nil).exists?
if TopicUser.where("user_id = ? AND topic_id = ? AND (notifications_reason_id IS NULL OR notification_level < ?)",
user_id, topic_id, notification_level).exists?
change(user_id, topic_id,
notification_level: notification_level,
notifications_reason_id: reason