Skip to content

Commit

Permalink
show replies only in local timeline for user
Browse files Browse the repository at this point in the history
  • Loading branch information
mashirozx committed Jul 15, 2020
1 parent ad4b4f7 commit 22dceec
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ def in_chosen_languages(account)
end

def as_public_timeline(account = nil, local_only = false)
query = timeline_scope(local_only).without_replies
if local_only
query = timeline_scope(local_only)
else
query = timeline_scope(local_only).without_replies
end

apply_timeline_filters(query, account, [:local, true].include?(local_only))
end
Expand Down
17 changes: 17 additions & 0 deletions spec/models/status_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@
expect(results).not_to include(reply)
end

it 'does not include replies' do
status = Fabricate(:status)
reply = Fabricate(:status, in_reply_to_id: status.id)

results = Status.as_public_timeline
expect(results).to include(status)
expect(results).not_to include(reply)
end

it 'does not include boosts' do
status = Fabricate(:status)
boost = Fabricate(:status, reblog_of_id: status.id)
Expand Down Expand Up @@ -356,6 +365,10 @@
expect(subject).to include(local_status)
expect(subject).not_to include(remote_status)
end

it 'does not include replies' do
expect(subject).not_to include(reply)
end
end

context 'with a viewer' do
Expand All @@ -366,6 +379,10 @@
expect(subject).not_to include(remote_status)
end

it 'does include replies' do
expect(subject).to include(reply)
end

it 'is not affected by personal domain blocks' do
viewer.block_domain!('test.com')
expect(subject).to include(local_status)
Expand Down

0 comments on commit 22dceec

Please sign in to comment.