Add notifications when a reblogged status has been updated (#17404)
* Add notifications when a reblogged status has been updated * Change wording to say "edit" instead of "update" and add missing controls * Replace previous update notifications with the most up-to-date one
This commit is contained in:
parent
d0fcf07436
commit
8f03b7a2fb
14 changed files with 103 additions and 8 deletions
|
@ -12,7 +12,14 @@ class LocalNotificationWorker
|
|||
activity = activity_class_name.constantize.find(activity_id)
|
||||
end
|
||||
|
||||
return if Notification.where(account: receiver, activity: activity).any?
|
||||
# For most notification types, only one notification should exist, and the older one is
|
||||
# preferred. For updates, such as when a status is edited, the new notification
|
||||
# should replace the previous ones.
|
||||
if type == 'update'
|
||||
Notification.where(account: receiver, activity: activity, type: 'update').in_batches.delete_all
|
||||
elsif Notification.where(account: receiver, activity: activity, type: type).any?
|
||||
return
|
||||
end
|
||||
|
||||
NotifyService.new.call(receiver, type || activity_class_name.underscore, activity)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue