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.
This commit is contained in:
Jeremy Friesen 2021-12-07 16:21:43 -05:00 committed by GitHub
parent d6e979e925
commit fda9cf9272
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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