mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Remove tags from experimental sidebar on notification level changed (#17083)
As part of this commit, a bug where updating a tag's notification level on the server side does not update the state of the user's tag notification levels on the client side is fixed too.
This commit is contained in:
committed by
GitHub
parent
47034d9ca0
commit
e7e23e8d9c
33
app/serializers/concerns/user_tag_notifications_mixin.rb
Normal file
33
app/serializers/concerns/user_tag_notifications_mixin.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module UserTagNotificationsMixin
|
||||
def muted_tags
|
||||
tags_with_notification_level(:muted)
|
||||
end
|
||||
|
||||
def tracked_tags
|
||||
tags_with_notification_level(:tracking)
|
||||
end
|
||||
|
||||
def watching_first_post_tags
|
||||
tags_with_notification_level(:watching_first_post)
|
||||
end
|
||||
|
||||
def watched_tags
|
||||
tags_with_notification_level(:watching)
|
||||
end
|
||||
|
||||
def regular_tags
|
||||
tags_with_notification_level(:regular)
|
||||
end
|
||||
|
||||
def tags_with_notification_level(lookup_level)
|
||||
tag_user_notification_levels.select do |id, level|
|
||||
level == TagUser.notification_levels[lookup_level]
|
||||
end.keys
|
||||
end
|
||||
|
||||
def tag_user_notification_levels
|
||||
@tag_user_notification_levels ||= TagUser.notification_levels_for(user)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user