about summary refs log tree commit diff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-06-29 18:27:34 +0200
committerGitHub <noreply@github.com>2022-06-29 18:27:34 +0200
commit54ed35f57c55fff639c8192b99fc60ab69c54f06 (patch)
tree78cee27bfe871569f3ae2e7aa62d847fe9df7046 /app/models/notification.rb
parent63f79874b59b3ba28c0f940b9d36ea7aacb44c93 (diff)
parent485b43ed7e312ab2c3bad446132c57d6a0ce7de4 (diff)
Merge pull request #1801 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r--app/models/notification.rb5
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