about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-16 00:21:51 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-16 00:21:51 +0200
commit5b0cef9781af519a0a6ace1f429162ae05863bde (patch)
treec7429316fa50f003451f2999ff30cc90c6506021 /app/controllers/api
parent2e7aac793ace0e938e45cb54ff601afa5d872214 (diff)
Setting up preliminary "detailed" routes in the UI, new API end-point for fetching status context
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/statuses_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb
index 0ef56580c..90e78a542 100644
--- a/app/controllers/api/statuses_controller.rb
+++ b/app/controllers/api/statuses_controller.rb
@@ -6,6 +6,12 @@ class Api::StatusesController < ApiController
     @status = Status.find(params[:id])
   end
 
+  def context
+    @status      = Status.find(params[:id])
+    @ancestors   = @status.ancestors.with_includes.with_counters
+    @descendants = @status.descendants.with_includes.with_counters
+  end
+
   def create
     @status = PostStatusService.new.(current_user.account, params[:status], params[:in_reply_to_id].blank? ? nil : Status.find(params[:in_reply_to_id]), params[:media_ids])
     render action: :show