0
0
Fork 0

Fix issue with trending order when user has chosen languages (#33557)

This commit is contained in:
Matt Jankowski 2025-01-13 09:27:30 -05:00 committed by GitHub
parent 0db7558822
commit f9451c5614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 58 additions and 13 deletions

View file

@ -24,6 +24,20 @@ RSpec.describe Trends::Links do
.to eq([lower_score.preview_card, higher_score.preview_card])
end
end
context 'when account has chosen languages' do
let!(:lang_match_higher_score) { Fabricate :preview_card_trend, score: 10, language: 'is' }
let!(:lang_match_lower_score) { Fabricate :preview_card_trend, score: 1, language: 'da' }
let(:user) { Fabricate :user, chosen_languages: %w(da is) }
let(:account) { Fabricate :account, user: user }
before { subject.filtered_for!(account) }
it 'returns results' do
expect(subject.records)
.to eq([lang_match_higher_score.preview_card, lang_match_lower_score.preview_card, higher_score.preview_card, lower_score.preview_card])
end
end
end
end
end

View file

@ -66,6 +66,20 @@ RSpec.describe Trends::Statuses do
.to eq([lower_score.status, higher_score.status])
end
end
context 'when account has chosen languages' do
let!(:lang_match_higher_score) { Fabricate :status_trend, score: 10, language: 'is' }
let!(:lang_match_lower_score) { Fabricate :status_trend, score: 1, language: 'da' }
let(:user) { Fabricate :user, chosen_languages: %w(da is) }
let(:account) { Fabricate :account, user: user }
before { subject.filtered_for!(account) }
it 'returns results' do
expect(subject.records)
.to eq([lang_match_higher_score.status, lang_match_lower_score.status, higher_score.status, lower_score.status])
end
end
end
end
end

View file

@ -50,6 +50,20 @@ RSpec.describe Trends::Tags do
.to eq([lower_score.tag, higher_score.tag])
end
end
context 'when account has chosen languages' do
let!(:lang_match_higher_score) { Fabricate :tag_trend, score: 10, language: 'is' }
let!(:lang_match_lower_score) { Fabricate :tag_trend, score: 1, language: 'da' }
let(:user) { Fabricate :user, chosen_languages: %w(da is) }
let(:account) { Fabricate :account, user: user }
before { subject.filtered_for!(account) }
it 'returns results' do
expect(subject.records)
.to eq([lang_match_higher_score.tag, lang_match_lower_score.tag, higher_score.tag, lower_score.tag])
end
end
end
end
end