diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-06-27 09:30:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 09:30:15 +0200 |
commit | 2936f42a14cfdca70d4a9653dab29382315945e7 (patch) | |
tree | 182a6660f1d8304ad893582732fb85db00e250aa /app/models | |
parent | 602f291da9f4fa157233b29dc6ac96e784203c98 (diff) |
Add notifications for new reports (#18697)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/notification.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb index ba94b54d1..bbc63c1c0 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -37,6 +37,7 @@ class Notification < ApplicationRecord poll update admin.sign_up + admin.report ).freeze TARGET_STATUS_INCLUDES_BY_TYPE = { @@ -46,6 +47,7 @@ class Notification < ApplicationRecord favourite: [favourite: :status], poll: [poll: :status], update: :status, + 'admin.report': [report: :target_account], }.freeze belongs_to :account, optional: true @@ -58,6 +60,7 @@ class Notification < ApplicationRecord belongs_to :follow_request, foreign_key: 'activity_id', optional: true belongs_to :favourite, foreign_key: 'activity_id', optional: true belongs_to :poll, foreign_key: 'activity_id', optional: true + belongs_to :report, foreign_key: 'activity_id', optional: true validates :type, inclusion: { in: TYPES } @@ -146,7 +149,7 @@ class Notification < ApplicationRecord return unless new_record? case activity_type - when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll' + when 'Status', 'Follow', 'Favourite', 'FollowRequest', 'Poll', 'Report' self.from_account_id = activity&.account_id when 'Mention' self.from_account_id = activity&.status&.account_id |