0
0
Fork 0

Add notifications of severed relationships (#27511)

This commit is contained in:
Claire 2024-03-20 16:37:21 +01:00 committed by GitHub
parent 8a1423a474
commit 44bf7b8128
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 781 additions and 54 deletions

View file

@ -54,6 +54,9 @@ class Notification < ApplicationRecord
update: {
filterable: false,
}.freeze,
severed_relationships: {
filterable: false,
}.freeze,
'admin.sign_up': {
filterable: false,
}.freeze,
@ -86,6 +89,7 @@ class Notification < ApplicationRecord
belongs_to :favourite, inverse_of: :notification
belongs_to :poll, inverse_of: false
belongs_to :report, inverse_of: false
belongs_to :relationship_severance_event, inverse_of: false
end
validates :type, inclusion: { in: TYPES }
@ -182,6 +186,11 @@ class Notification < ApplicationRecord
self.from_account_id = activity&.status&.account_id
when 'Account'
self.from_account_id = activity&.id
when 'AccountRelationshipSeveranceEvent'
# These do not really have an originating account, but this is mandatory
# in the data model, and the recipient's account will by definition
# always exist
self.from_account_id = account_id
end
end