Fix featured tags for remote accounts not being kept up to date (#33372)

This commit is contained in:
Claire 2024-12-20 12:50:31 +01:00 committed by GitHub
parent d31d988e24
commit 344e2903b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 147 additions and 24 deletions

View file

@ -256,16 +256,22 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService do
updated: '2021-09-08T22:39:25Z',
tag: [
{ type: 'Hashtag', name: 'foo' },
{ type: 'Hashtag', name: 'bar' },
],
}
end
before do
subject.call(status, json, json)
status.account.featured_tags.create!(name: 'bar')
status.account.featured_tags.create!(name: 'test')
end
it 'updates tags' do
expect(status.tags.reload.map(&:name)).to eq %w(foo)
it 'updates tags and featured tags' do
expect { subject.call(status, json, json) }
.to change { status.tags.reload.pluck(:name) }.from(%w(test foo)).to(%w(foo bar))
.and change { status.account.featured_tags.find_by(name: 'test').statuses_count }.by(-1)
.and change { status.account.featured_tags.find_by(name: 'bar').statuses_count }.by(1)
.and change { status.account.featured_tags.find_by(name: 'bar').last_status_at }.from(nil).to(be_within(0.1).of(Time.now.utc))
end
end