Merge pull request #1193 from johnholdun/local-only-public-hashtag
Hide local-only posts from public tag view
This commit is contained in:
commit
e70e576ba5
|
@ -41,7 +41,8 @@ class Api::V1::Timelines::TagController < Api::BaseController
|
|||
none: params[:none],
|
||||
local: truthy_param?(:local),
|
||||
remote: truthy_param?(:remote),
|
||||
only_media: truthy_param?(:only_media)
|
||||
only_media: truthy_param?(:only_media),
|
||||
without_local_only: !current_user
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ class PublicFeed
|
|||
options[:local]
|
||||
end
|
||||
|
||||
def without_local_only?
|
||||
options[:without_local_only]
|
||||
end
|
||||
|
||||
def remote_only?
|
||||
options[:remote]
|
||||
end
|
||||
|
@ -75,6 +79,10 @@ class PublicFeed
|
|||
Status.remote
|
||||
end
|
||||
|
||||
def without_local_only_scope
|
||||
Status.without_local_only
|
||||
end
|
||||
|
||||
def without_replies_scope
|
||||
Status.without_replies
|
||||
end
|
||||
|
|
|
@ -32,6 +32,7 @@ class TagFeed < PublicFeed
|
|||
scope.merge!(remote_only_scope) if remote_only?
|
||||
scope.merge!(account_filters_scope) if account?
|
||||
scope.merge!(media_only_scope) if media_only?
|
||||
scope.merge!(without_local_only_scope) if without_local_only?
|
||||
|
||||
scope.cache_ids.to_a_paginated_by_id(limit, max_id: max_id, since_id: since_id, min_id: min_id)
|
||||
end
|
||||
|
|
|
@ -57,6 +57,12 @@ describe TagFeed, type: :service do
|
|||
expect(results).to_not include status1
|
||||
end
|
||||
|
||||
it 'excludes local-only posts when specified' do
|
||||
status1.update(local_only: true)
|
||||
results = described_class.new(tag1, nil, any: [tag2.name], without_local_only: true).get(20)
|
||||
expect(results).to_not include status1
|
||||
end
|
||||
|
||||
it 'allows replies to be included' do
|
||||
original = Fabricate(:status)
|
||||
status = Fabricate(:status, tags: [tag1], in_reply_to_id: original.id)
|
||||
|
|
Loading…
Reference in New Issue