about summary refs log tree commit diff
path: root/app/controllers/stream_entries_controller.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/controllers/stream_entries_controller.rb
parent85d89b472dff2c3d06801dbd42f91c325d21a434 (diff)
Fix for single status pages
Diffstat (limited to 'app/controllers/stream_entries_controller.rb')
-rw-r--r--app/controllers/stream_entries_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/stream_entries_controller.rb b/app/controllers/stream_entries_controller.rb
index 1e50d3b60..c26149627 100644
--- a/app/controllers/stream_entries_controller.rb
+++ b/app/controllers/stream_entries_controller.rb
@@ -7,6 +7,20 @@ class StreamEntriesController < ApplicationController
   def show
     @type = @stream_entry.activity_type.downcase
 
+    if @stream_entry.activity_type == 'Status'
+      @ancestors   = @stream_entry.activity.ancestors.with_includes.with_counters
+      @descendants = @stream_entry.activity.descendants.with_includes.with_counters
+
+      if user_signed_in?
+        status_ids  = [@stream_entry.activity_id] + @ancestors.map { |s| s.id } + @descendants.map { |s| s.id }
+        @favourited = Status.favourites_map(status_ids, current_user.account_id)
+        @reblogged  = Status.reblogs_map(status_ids, current_user.account_id)
+      else
+        @favourited = {}
+        @reblogged  = {}
+      end
+    end
+
     respond_to do |format|
       format.html
       format.atom