about summary refs log tree commit diff
path: root/app/views/api/v1/statuses/show.rabl
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-03 14:50:22 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-03 14:50:22 +0100
commite4671adc25081161268c885b3427fd84cbecb249 (patch)
tree0bd6e1cdbdad43225574a64a712e2fe0bc4f1817 /app/views/api/v1/statuses/show.rabl
parentc003e7075880071743af06cfb5865bdb943db024 (diff)
Fix reblogged/favourited caching; add API endpoints for who favd/reblogged status
Diffstat (limited to 'app/views/api/v1/statuses/show.rabl')
-rw-r--r--app/views/api/v1/statuses/show.rabl7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/views/api/v1/statuses/show.rabl b/app/views/api/v1/statuses/show.rabl
index 1c586a3a5..1b4651cdd 100644
--- a/app/views/api/v1/statuses/show.rabl
+++ b/app/views/api/v1/statuses/show.rabl
@@ -1,8 +1,13 @@
 object @status
-cache
 
 extends 'api/v1/statuses/_show'
 
+node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? !!@favourites_map[status.id] : current_account.favourited?(status) }
+node(:reblogged,  if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map)    ? !!@reblogs_map[status.id]    : current_account.reblogged?(status) }
+
 child :reblog => :reblog do
   extends 'api/v1/statuses/_show'
+
+  node(:favourited, if: proc { !current_account.nil? }) { |status| defined?(@favourites_map) ? !!@favourites_map[status.id] : current_account.favourited?(status) }
+  node(:reblogged,  if: proc { !current_account.nil? }) { |status| defined?(@reblogs_map)    ? !!@reblogs_map[status.id]    : current_account.reblogged?(status) }
 end