From fda9cf9272e7e350b121ae2a706dfb6cb51437f3 Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Tue, 7 Dec 2021 16:21:43 -0500 Subject: [PATCH] Renaming constant to reflect intention (#15708) While in it's own namespace, the `VALID_ROLES` constant is used throughout the Policies and Liquid Tags to reflect permissions. In this case, the constant is not related to granting permissions but to see who has these roles. --- app/queries/admin/moderators_query.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/queries/admin/moderators_query.rb b/app/queries/admin/moderators_query.rb index 0857d9ec0..de3fdc8eb 100644 --- a/app/queries/admin/moderators_query.rb +++ b/app/queries/admin/moderators_query.rb @@ -4,7 +4,7 @@ module Admin state: :trusted }.with_indifferent_access.freeze - VALID_ROLES = %i[comment_suspended suspended trusted warned].freeze + POTENTIAL_ROLE_NAMES = %i[comment_suspended suspended trusted warned].freeze def self.call(relation: User.all, options: {}) options = DEFAULT_OPTIONS.merge(options) @@ -29,7 +29,7 @@ module Admin end def self.potential_role_ids - @potential_role_ids ||= Role.where(name: VALID_ROLES).select(:id) + @potential_role_ids ||= Role.where(name: POTENTIAL_ROLE_NAMES).select(:id) end def self.search_relation(relation, search)