about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-23 18:13:12 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-23 18:13:12 +0100
commit3d25fe042679e7f5b9095983feb22f46e24c3033 (patch)
tree18b57e7abf4f3edf55f057efd6eb47da698bf0f6 /app/models
parent2c8615fbf8f8085eb836733b27b33c9522c29c71 (diff)
parent0db101ede2eb9f8869932135785b0d83cd05560e (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `.github/workflows/build-image.yml`:
  Upstream changed the workflow a bit.
  Conflict comes from us pushing to ghcr while upstream pushes to dockerhub.
  Ported the upstream changes while still pushing to ghcr.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/notification.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index c14eb8a7e..9bf296386 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -36,6 +36,7 @@ class Notification < ApplicationRecord
     favourite
     poll
     update
+    admin.sign_up
   ).freeze
 
   TARGET_STATUS_INCLUDES_BY_TYPE = {
@@ -63,13 +64,10 @@ class Notification < ApplicationRecord
   scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) }
 
   scope :browserable, ->(exclude_types = [], account_id = nil) {
-    types = TYPES - exclude_types.map(&:to_sym)
-
-    if account_id.nil?
-      where(type: types)
-    else
-      where(type: types, from_account_id: account_id)
-    end
+    scope = all
+    scope = where(from_account_id: account_id) if account_id.present?
+    scope = scope.where(type: TYPES - exclude_types.map(&:to_sym)) unless exclude_types.empty?
+    scope
   }
 
   def type
@@ -142,6 +140,8 @@ class Notification < ApplicationRecord
       self.from_account_id = activity&.account_id
     when 'Mention'
       self.from_account_id = activity&.status&.account_id
+    when 'Account'
+      self.from_account_id = activity&.id
     end
   end
 end