0
0
Fork 0

Add in-app notifications for moderation actions/warnings (#30065)

This commit is contained in:
Claire 2024-04-25 19:26:05 +02:00 committed by GitHub
parent 0ec061aa8f
commit 4ef0b48b95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 188 additions and 21 deletions

View file

@ -57,6 +57,9 @@ class Notification < ApplicationRecord
severed_relationships: {
filterable: false,
}.freeze,
moderation_warning: {
filterable: false,
}.freeze,
'admin.sign_up': {
filterable: false,
}.freeze,
@ -90,6 +93,7 @@ class Notification < ApplicationRecord
belongs_to :poll, inverse_of: false
belongs_to :report, inverse_of: false
belongs_to :account_relationship_severance_event, inverse_of: false
belongs_to :account_warning, inverse_of: false
end
validates :type, inclusion: { in: TYPES }
@ -180,7 +184,7 @@ class Notification < ApplicationRecord
return unless new_record?
case activity_type
when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report'
when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report', 'AccountWarning'
self.from_account_id = activity&.account_id
when 'Mention'
self.from_account_id = activity&.status&.account_id