add ability to access bookmarks from #self.bookmarks tag
parent
879166633c
commit
1cd9fea3b5
|
@ -28,6 +28,8 @@ class Api::V1::Timelines::TagController < Api::BaseController
|
||||||
def tagged_statuses
|
def tagged_statuses
|
||||||
if @tag.nil?
|
if @tag.nil?
|
||||||
[]
|
[]
|
||||||
|
elsif @tag.name.in?(['self.bookmarks', '.self.bookmarks'])
|
||||||
|
Status.reorder(nil).joins(:bookmarks).merge(bookmark_results)
|
||||||
else
|
else
|
||||||
statuses = tag_timeline_statuses.paginate_by_id(
|
statuses = tag_timeline_statuses.paginate_by_id(
|
||||||
limit_param(DEFAULT_STATUSES_LIMIT),
|
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))
|
HashtagQueryService.new.call(@tag, params.slice(:any, :all, :none), current_account, truthy_param?(:local))
|
||||||
end
|
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
|
def insert_pagination_headers
|
||||||
set_pagination_headers(next_path, prev_path)
|
set_pagination_headers(next_path, prev_path)
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
class CreateBookmarkTags < ActiveRecord::Migration[5.2]
|
||||||
|
def up
|
||||||
|
%w(self.bookmarks .self.bookmarks).each { |name| Tag.find_or_create_by(name: name) }
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue