Skip to content

Commit

Permalink
autofix rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonfranzen committed Sep 18, 2020
1 parent ca62b38 commit dde6fcf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/graphql/mutations/companies/update_company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def resolve(id:, attributes:)
# find company
company = ::Companies::Company.accessible_by(current_ability).find_by(id: id)
if company.nil?
raise ActiveRecord::RecordNotFound, I18n.t('errors.messages.resource_not_found', resource: ::Companies::Company.model_name.human)
raise ActiveRecord::RecordNotFound,
I18n.t('errors.messages.resource_not_found', resource: ::Companies::Company.model_name.human)
end

company.attributes = attributes.to_h
Expand Down
3 changes: 2 additions & 1 deletion app/graphql/mutations/users/delete_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class DeleteUser < Mutations::BaseMutation
def resolve(id:)
user = ::User.accessible_by(current_ability).find_by(id: id)
if user.nil?
raise ActiveRecord::RecordNotFound, I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human)
raise ActiveRecord::RecordNotFound,
I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human)
end

current_ability.authorize! :destroy, user
Expand Down
5 changes: 4 additions & 1 deletion app/graphql/mutations/users/update_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class UpdateUser < Mutations::BaseMutation

def resolve(id:, attributes:)
user = ::User.accessible_by(current_ability).find_by(id: id)
raise ActiveRecord::RecordNotFound, I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human) if user.nil?
if user.nil?
raise ActiveRecord::RecordNotFound,
I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human)
end

user.attributes = attributes.to_h
current_ability.authorize! :update, user
Expand Down
3 changes: 2 additions & 1 deletion app/graphql/mutations/users/update_user_role.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class UpdateUserRole < Mutations::BaseMutation
def resolve(id:, role:)
user = ::User.accessible_by(current_ability).find_by(id: id)
if user.nil?
raise ActiveRecord::RecordNotFound, I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human)
raise ActiveRecord::RecordNotFound,
I18n.t('errors.messages.resource_not_found', resource: ::User.model_name.human)
end

if %w[admin user].include?(role)
Expand Down

0 comments on commit dde6fcf

Please sign in to comment.