diff options
author | multiple creatures <dev@multiple-creature.party> | 2019-12-21 15:24:34 -0600 |
---|---|---|
committer | multiple creatures <dev@multiple-creature.party> | 2019-12-21 15:25:32 -0600 |
commit | 806199ed4ae23fd165397b41405523e672c7e090 (patch) | |
tree | 3b224576fcea701a35b18449a5e2cedd5f0ca01d /app/controllers/api/v1 | |
parent | 5f92c6429fac98e5c9e3b02d158b6d4eab89945d (diff) |
add virtual scopes for `#``self.boosts` (your boosts) & `#``self.home.boosts` (boosts on your home timeline)
Diffstat (limited to 'app/controllers/api/v1')
-rw-r--r-- | app/controllers/api/v1/timelines/tag_controller.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/app/controllers/api/v1/timelines/tag_controller.rb b/app/controllers/api/v1/timelines/tag_controller.rb index 8316d8a9f..7e60e422b 100644 --- a/app/controllers/api/v1/timelines/tag_controller.rb +++ b/app/controllers/api/v1/timelines/tag_controller.rb @@ -30,6 +30,10 @@ class Api::V1::Timelines::TagController < Api::BaseController [] elsif @tag.name.in?(['self.bookmarks', '.self.bookmarks']) Status.reorder(nil).joins(:bookmarks).merge(bookmark_results) + elsif @tag.name.in?(['self.boosts', '.self.boosts']) + reblog_results + elsif @tag.name.in?(['self.home.boosts', '.self.home.boosts']) + home_reblog_results else statuses = tag_timeline_statuses.paginate_by_id( limit_param(DEFAULT_STATUSES_LIMIT), @@ -51,7 +55,7 @@ class Api::V1::Timelines::TagController < Api::BaseController end def bookmark_results - @_results ||= account_bookmarks.paginate_by_max_id( + account_bookmarks.paginate_by_max_id( limit_param(DEFAULT_STATUSES_LIMIT), params[:max_id], params[:since_id] @@ -62,6 +66,30 @@ class Api::V1::Timelines::TagController < Api::BaseController current_account.bookmarks end + def reblog_results + account_reblogs.paginate_by_max_id( + limit_param(DEFAULT_STATUSES_LIMIT), + params[:max_id], + params[:since_id] + ) + end + + def account_reblogs + current_account.statuses.reblogs + end + + def home_reblog_results + account_home_reblogs.paginate_by_max_id( + limit_param(DEFAULT_STATUSES_LIMIT), + params[:max_id], + params[:since_id] + ) + end + + def account_home_reblogs + Status.as_home_timeline(current_account, reblogs_only: true) + end + def insert_pagination_headers set_pagination_headers(next_path, prev_path) end |