Removing deprecated User methods (#16435)
* Removing deprecated User methods Related to #15762, #15691, and #15624 * Bump for travis
This commit is contained in:
parent
0a07ae8fe9
commit
30a894a6eb
5 changed files with 2 additions and 16 deletions
|
|
@ -22,7 +22,7 @@ class RatingVote < ApplicationRecord
|
|||
end
|
||||
|
||||
def permissions
|
||||
return unless context == "explicit" && !user&.trusted && user_id != article&.user_id
|
||||
return unless context == "explicit" && !user&.trusted? && user_id != article&.user_id
|
||||
|
||||
errors.add(:user_id, I18n.t("models.rating_vote.not_permitted"))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ResponseTemplate < ApplicationRecord
|
|||
|
||||
def template_count
|
||||
return unless user
|
||||
return if user.trusted || user.response_templates.count <= 30
|
||||
return if user.trusted? || user.response_templates.count <= 30
|
||||
|
||||
errors.add(:user, I18n.t("models.response_template.limit_reached"))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -409,11 +409,9 @@ class User < ApplicationRecord
|
|||
:suspended?,
|
||||
:tag_moderator?,
|
||||
:tech_admin?,
|
||||
:trusted, # TODO: Remove this method from the code-base
|
||||
:trusted?,
|
||||
:user_subscription_tag_available?,
|
||||
:vomited_on?,
|
||||
:warned, # TODO: Remove this method from the code-base
|
||||
:warned?,
|
||||
:workshop_eligible?,
|
||||
to: :authorizer,
|
||||
|
|
|
|||
|
|
@ -133,11 +133,6 @@ module Authorizer
|
|||
has_any_role?(:tech_admin, :super_admin)
|
||||
end
|
||||
|
||||
def trusted
|
||||
ActiveSupport::Deprecation.warn("User#trusted is deprecated, favor User#trusted?")
|
||||
trusted?
|
||||
end
|
||||
|
||||
def trusted?
|
||||
return @trusted if defined? @trusted
|
||||
|
||||
|
|
@ -158,11 +153,6 @@ module Authorizer
|
|||
has_role?(:warned)
|
||||
end
|
||||
|
||||
def warned
|
||||
ActiveSupport::Deprecation.warn("User#warned is deprecated, favor User#warned?")
|
||||
warned?
|
||||
end
|
||||
|
||||
def workshop_eligible?
|
||||
has_any_role?(:workshop_pass)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -52,11 +52,9 @@ RSpec.describe User, type: :model do
|
|||
it { is_expected.to delegate_method(:suspended?).to(:authorizer) }
|
||||
it { is_expected.to delegate_method(:tag_moderator?).to(:authorizer) }
|
||||
it { is_expected.to delegate_method(:tech_admin?).to(:authorizer) }
|
||||
it { is_expected.to delegate_method(:trusted).to(:authorizer) }
|
||||
it { is_expected.to delegate_method(:trusted?).to(:authorizer) }
|
||||
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(:warned?).to(:authorizer) }
|
||||
it { is_expected.to delegate_method(:workshop_eligible?).to(:authorizer) }
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue