about summary refs log tree commit diff
path: root/app/controllers/api
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-08-05 01:53:59 -0500
committermultiple creatures <dev@multiple-creature.party>2019-08-05 01:53:59 -0500
commit1cd9fea3b5a8b87df7fc2c102c102bca7519151a (patch)
tree8f673aacf7bf8443405870aa4bee59b0a0fceefe /app/controllers/api
parent879166633c3e2d8df656c678349a71e86c647b5d (diff)
add ability to access bookmarks from #self.bookmarks tag
Diffstat (limited to 'app/controllers/api')
-rw-r--r--app/controllers/api/v1/timelines/tag_controller.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/controllers/api/v1/timelines/tag_controller.rb b/app/controllers/api/v1/timelines/tag_controller.rb
index 9adc4ad29..a0a10d349 100644
--- a/app/controllers/api/v1/timelines/tag_controller.rb
+++ b/app/controllers/api/v1/timelines/tag_controller.rb
@@ -28,6 +28,8 @@ class Api::V1::Timelines::TagController < Api::BaseController
   def tagged_statuses
     if @tag.nil?
       []
+    elsif @tag.name.in?(['self.bookmarks', '.self.bookmarks'])
+      Status.reorder(nil).joins(:bookmarks).merge(bookmark_results)
     else
       statuses = tag_timeline_statuses.paginate_by_id(
         limit_param(DEFAULT_STATUSES_LIMIT),
@@ -48,6 +50,18 @@ class Api::V1::Timelines::TagController < Api::BaseController
     HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, truthy_param?(:local))
   end
 
+  def bookmark_results
+    @_results ||= account_bookmarks.paginate_by_max_id(
+      limit_param(DEFAULT_STATUSES_LIMIT),
+      params[:max_id],
+      params[:since_id]
+    )
+  end
+
+  def account_bookmarks
+    current_account.bookmarks
+  end
+
   def insert_pagination_headers
     set_pagination_headers(next_path, prev_path)
   end