mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 16:59:41 +00:00
Fix issue with trending order when user has chosen languages (#33557)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user