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:
Régis Hanol
2024-07-04 19:27:26 +02:00
committed by GitHub
parent a30a861546
commit 0dbcc54d4b
8 changed files with 83 additions and 76 deletions

View File

@@ -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

View File

@@ -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