about summary refs log tree commit diff
diff options
context:
space:
mode:
authorabcang <abcang1015@gmail.com>2018-02-08 23:33:23 +0900
committerEugen Rochko <eugen@zeonfederated.com>2018-02-08 15:33:23 +0100
commit298c81c00f951241f026b0b3f711ead405b78fbe (patch)
treeaa2b8f9c15b8492a79a3a6dee65d4360961aaabf
parentcf32f7da5c5af7c86af3cab89d18cdbe7b35f4a2 (diff)
Clear account cache of notification target_status (#6442)
-rw-r--r--app/models/notification.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index 733f89cf7..7f8dae5ec 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -69,7 +69,7 @@ class Notification < ApplicationRecord
 
   class << self
     def reload_stale_associations!(cached_items)
-      account_ids = cached_items.map(&:from_account_id).uniq
+      account_ids = (cached_items.map(&:from_account_id) + cached_items.map { |item| item.target_status&.account_id }.compact).uniq
 
       return if account_ids.empty?
 
@@ -77,6 +77,7 @@ class Notification < ApplicationRecord
 
       cached_items.each do |item|
         item.from_account = accounts[item.from_account_id]
+        item.target_status.account = accounts[item.target_status.account_id] if item.target_status
       end
     end