Remove dead code associated with old roles (#20175)

* Remove dead code associated with old roles

* Remove test references

* Removed from seeds

* Removed unused roles from locales

---------

Co-authored-by: lightalloy <lightallloy@gmail.com>
This commit is contained in:
Ben Halpern 2023-10-01 09:33:25 +07:00 committed by GitHub
parent 33197e73e8
commit c5201ca888
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 3 additions and 16 deletions

View file

@ -4,7 +4,6 @@ class Role < ApplicationRecord
codeland_admin
comment_suspended
creator
mod_relations_admin
super_moderator
podcast_admin
restricted_liquid_tag
@ -16,7 +15,6 @@ class Role < ApplicationRecord
tech_admin
trusted
warned
workshop_pass
limited
].freeze

View file

@ -451,7 +451,6 @@ class User < ApplicationRecord
:user_subscription_tag_available?,
:vomited_on?,
:warned?,
:workshop_eligible?,
to: :authorizer,
)
alias suspended suspended?

View file

@ -165,10 +165,6 @@ module Authorizer
has_role?(:warned)
end
def workshop_eligible?
has_any_role?(:workshop_pass)
end
def clear_cache
remove_instance_variable(:@trusted) if defined? @trusted
end

View file

@ -29,7 +29,6 @@ module Moderator
end
def remove_privileges
@user.remove_role(:workshop_pass)
remove_mod_roles
remove_tag_moderator_role
end

View file

@ -286,7 +286,6 @@ en:
comment_suspended: Comment Suspended
limited: Limited
creator: Creator
mod_relations_admin: Mod Relations Admin
super_moderator: Super Moderator
podcast_admin: Podcast Admin
restricted_liquid_tag: Restricted Liquid Tag
@ -311,7 +310,6 @@ en:
tech_admin: Tech Admin
trusted: Trusted
warned: Warned
workshop_pass: Workshop Pass
tag_mod:
subtitle: Tags
aria_learn: Learn more about tag moderation

View file

@ -286,7 +286,6 @@ fr:
comment_suspended: Comment Suspended
limited: Limited
creator: Creator
mod_relations_admin: Mod Relations Admin
super_moderator: Super Moderator
podcast_admin: Podcast Admin
restricted_liquid_tag: Restricted Liquid Tag
@ -309,7 +308,6 @@ fr:
tech_admin: Tech Admin
trusted: Trusted
warned: Warned
workshop_pass: Workshop Pass
tag_mod:
subtitle: Tags
aria_learn: Learn more about tag moderation

View file

@ -55,7 +55,7 @@ end
num_users = 10 * SEEDS_MULTIPLIER
users_in_random_order = seeder.create_if_none(User, num_users) do
roles = %i[trusted workshop_pass]
roles = %i[trusted]
num_users.times do |i|
fname = Faker::Name.unique.first_name

View file

@ -8,9 +8,9 @@ RSpec.describe Role do
describe "::ROLES" do
it "contains the correct values" do
expected_roles = %w[
admin codeland_admin comment_suspended limited mod_relations_admin podcast_admin
admin codeland_admin comment_suspended limited podcast_admin
restricted_liquid_tag single_resource_admin super_admin support_admin suspended tag_moderator tech_admin
trusted warned workshop_pass creator super_moderator
trusted warned creator super_moderator
]
expect(described_class::ROLES).to match_array(expected_roles)
end

View file

@ -57,7 +57,6 @@ RSpec.describe User do
it { is_expected.to delegate_method(:user_subscription_tag_available?).to(:authorizer) }
it { is_expected.to delegate_method(:vomited_on?).to(:authorizer) }
it { is_expected.to delegate_method(:warned?).to(:authorizer) }
it { is_expected.to delegate_method(:workshop_eligible?).to(:authorizer) }
end
describe "validations" do