DEV: Allow specifying if a notification is high_priority on create (#9660)

This allows for special cases where we may not want a certain notification type to ALWAYS be high priority (e.g. a topic timer).
This commit is contained in:
Martin Brennan
2020-05-07 14:35:32 +10:00
committed by GitHub
parent be48e503fd
commit 37be2958f7
2 changed files with 21 additions and 1 deletions

View File

@@ -45,7 +45,9 @@ class Notification < ActiveRecord::Base
end
before_create do
self.high_priority = Notification.high_priority_types.include?(self.notification_type)
# if we have manually set the notification to high_priority on create then
# make sure that is respected
self.high_priority = self.high_priority || Notification.high_priority_types.include?(self.notification_type)
end
def self.purge_old!