FIX: Muted tags are respected by TopicTrackingState (#8467)

When the tag is muted and topic contains that tag, we should not mark that message as NEW.

There are 3 possible settings which site admin can set.
remove_muted_tags_from_latest - always
It means that if the topic got at least one muted tag, we should not mark that topic as NEW

remove_muted_tags_from_latest - only muted
Similar to above, however, if at least one tag is not muted, the topic is marked as NEW

remove_muted_tags_from_latest - never
Basically, mute tag setting is ignored and all topics are set as NEW
This commit is contained in:
Krzysztof Kotlarek
2019-12-10 09:50:05 +11:00
committed by GitHub
parent 6740e08caa
commit 81c7d6a462
5 changed files with 140 additions and 4 deletions

View File

@@ -27,6 +27,7 @@ class CurrentUserSerializer < BasicUserSerializer
:redirected_to_top,
:custom_fields,
:muted_category_ids,
:muted_tag_ids,
:dismissed_banner_key,
:is_anonymous,
:reviewable_count,
@@ -169,6 +170,10 @@ class CurrentUserSerializer < BasicUserSerializer
CategoryUser.lookup(object, :muted).pluck(:category_id)
end
def muted_tag_ids
TagUser.lookup(object, :muted).pluck(:tag_id)
end
def ignored_users
IgnoredUser.where(user: object.id).joins(:ignored_user).pluck(:username)
end