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:
commit
ecace5085c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue