mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: use new 'ignore allowed groups' site settings (#27670)
Instead of the deprecated 'min trust level to allow ignore' in order to reduce the number of deprecation notices in the logs. This tweaks a few serializers so that the 'can_ignore_users?` property is always coming from the server and properly used on the client-side.
This commit is contained in:
@@ -147,7 +147,7 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||
end
|
||||
|
||||
def can_ignore_users
|
||||
!is_anonymous && object.in_any_groups?(SiteSetting.ignore_allowed_groups_map)
|
||||
scope.can_ignore_users?
|
||||
end
|
||||
|
||||
def can_delete_all_posts_and_topics
|
||||
|
||||
@@ -51,7 +51,9 @@ class UserSerializer < UserCardSerializer
|
||||
:custom_avatar_template,
|
||||
:has_title_badges,
|
||||
:muted_usernames,
|
||||
:can_mute_users,
|
||||
:ignored_usernames,
|
||||
:can_ignore_users,
|
||||
:allowed_pm_usernames,
|
||||
:mailing_list_posts_per_day,
|
||||
:can_change_bio,
|
||||
@@ -254,10 +256,18 @@ class UserSerializer < UserCardSerializer
|
||||
MutedUser.where(user_id: object.id).joins(:muted_user).pluck(:username)
|
||||
end
|
||||
|
||||
def can_mute_users
|
||||
scope.can_mute_users?
|
||||
end
|
||||
|
||||
def ignored_usernames
|
||||
IgnoredUser.where(user_id: object.id).joins(:ignored_user).pluck(:username)
|
||||
end
|
||||
|
||||
def can_ignore_users
|
||||
scope.can_ignore_users?
|
||||
end
|
||||
|
||||
def allowed_pm_usernames
|
||||
AllowedPmUser.where(user_id: object.id).joins(:allowed_pm_user).pluck(:username)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user