Fix: ドメインブロックのトレンド掲載を拒否に、ハッシュタグが含まれない問題 (#676)

This commit is contained in:
KMY(雪あすか) 2024-03-27 12:11:11 +09:00 committed by GitHub
parent cf45a61ee1
commit 619802b827
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 0 deletions

View file

@ -23,6 +23,33 @@ RSpec.describe Trends::Tags do
end
end
describe '#register' do
let(:tag) { Fabricate(:tag, usable: true) }
let(:account) { Fabricate(:account) }
let(:status) { Fabricate(:status, account: account, tags: [tag], created_at: at_time, updated_at: at_time) }
it 'records history' do
subject.register(status, at_time)
expect(tag.history.get(at_time).accounts).to eq 1
expect(tag.history.get(at_time).uses).to eq 1
expect(subject.send(:recently_used_ids, at_time)).to eq [tag.id]
end
context 'when account is rejected appending trends' do
let(:account) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/actor') }
before do
Fabricate(:domain_block, domain: 'example.com', block_trends: true, severity: :noop)
end
it 'does not record history' do
subject.register(status, at_time)
expect(tag.history.get(at_time).accounts).to eq 0
expect(tag.history.get(at_time).uses).to eq 0
end
end
end
describe '#query' do
it 'returns a composable query scope' do
expect(subject.query).to be_a Trends::Query