about summary refs log tree commit diff
path: root/app/models/status.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-08 21:23:29 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-08 21:23:29 +0200
commit762157ee4e6bab04fb66903651e901bc83e333bb (patch)
tree93fe51ece850c6fac05bfbada2b9d57c6697b5cf /app/models/status.rb
parent85d89b472dff2c3d06801dbd42f91c325d21a434 (diff)
Fix for single status pages
Diffstat (limited to 'app/models/status.rb')
-rw-r--r--app/models/status.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/status.rb b/app/models/status.rb
index 12c58733c..4adf2944c 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -75,4 +75,12 @@ class Status < ApplicationRecord
   def self.as_mentions_timeline(account)
     self.where(id: Mention.where(account: account).pluck(:status_id)).with_includes.with_counters
   end
+
+  def self.favourites_map(status_ids, account_id)
+    Favourite.where(status_id: status_ids).where(account_id: account_id).map { |f| [f.status_id, true] }.to_h
+  end
+
+  def self.reblogs_map(status_ids, account_id)
+    self.where(reblog_of_id: status_ids).where(account_id: account_id).map { |s| [s.reblog_of_id, true] }.to_h
+  end
 end