mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 12:12:26 +08:00
FIX: Listing topics with muted mixed-case tags (#10268)
When visiting a tag page directly, we should display all topics, even if that tag is muted. This was not working for mixed-case tags.
This commit is contained in:
parent
9313706649
commit
5f3dfce4eb
|
@ -890,7 +890,7 @@ class TopicQuery
|
|||
|
||||
# if viewing the topic list for a muted tag, show all the topics
|
||||
if !opts[:no_tags] && opts[:tags].present?
|
||||
return list if TagUser.lookup(user, :muted).joins(:tag).where('tags.name = ?', opts[:tags].first).exists?
|
||||
return list if TagUser.lookup(user, :muted).joins(:tag).where('lower(tags.name) = ?', opts[:tags].first.downcase).exists?
|
||||
end
|
||||
|
||||
if SiteSetting.remove_muted_tags_from_latest == 'always'
|
||||
|
|
|
@ -362,6 +362,22 @@ describe TopicQuery do
|
|||
topic_ids = topic_query.list_new.topics.map(&:id)
|
||||
expect(topic_ids).to contain_exactly(muted_topic.id, tagged_topic.id, muted_tagged_topic.id, untagged_topic.id)
|
||||
end
|
||||
|
||||
it 'is not removed from the tag page itself' do
|
||||
muted_tag = Fabricate(:tag)
|
||||
TagUser.create!(user_id: user.id,
|
||||
tag_id: muted_tag.id,
|
||||
notification_level: CategoryUser.notification_levels[:muted])
|
||||
|
||||
muted_topic = Fabricate(:topic, tags: [muted_tag])
|
||||
|
||||
topic_ids = topic_query.latest_results(tags: [muted_tag.name]).map(&:id)
|
||||
expect(topic_ids).to contain_exactly(muted_topic.id)
|
||||
|
||||
muted_tag.update(name: "mixedCaseName")
|
||||
topic_ids = topic_query.latest_results(tags: [muted_tag.name.downcase]).map(&:id)
|
||||
expect(topic_ids).to contain_exactly(muted_topic.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'a bunch of topics' do
|
||||
|
|
Loading…
Reference in New Issue
Block a user