Fix rubocop issues and a stray typo spotted along the way

This commit is contained in:
Maciej Szlosarczyk 2018-08-10 14:43:06 +03:00
parent 647cb53404
commit 9d7dc59652
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
4 changed files with 16 additions and 21 deletions

View file

@ -1,14 +1,15 @@
module Admin module Admin
module Domains module Domains
class RegistryLockController < BaseController class RegistryLockController < BaseController
def destroy def destroy
set_domain set_domain
authorize! :manage, @domain authorize! :manage, @domain
if @domain.remove_registry_lock if @domain.remove_registry_lock
redirect_to edit_admin_domain_url(@domain), notice: t('admin.domains.registry_lock_delete.success') redirect_to edit_admin_domain_url(@domain),
notice: t('admin.domains.registry_lock_delete.success')
else else
redirect_to edit_admin_domain_url(@domain), alert: t('admin.domains.registry_lock_delete.error') redirect_to edit_admin_domain_url(@domain),
alert: t('admin.domains.registry_lock_delete.error')
end end
end end

View file

@ -47,7 +47,7 @@ module Admin
def destroy def destroy
@mail_template = MailTemplate.find(params[:id]) @mail_template = MailTemplate.find(params[:id])
if @mail_template.destroy if @mail_template.destroy
redirect_to admin_mail_templates_path, notise: t(:deleted) redirect_to admin_mail_templates_path, notice: t(:deleted)
else else
flash.now[:alert] = I18n.t(:failure) flash.now[:alert] = I18n.t(:failure)
render 'show' render 'show'

View file

@ -15,14 +15,10 @@ module Concerns::Domain::Lockable
end end
def registry_lockable? def registry_lockable?
(statuses & [ (statuses & [DomainStatus::PENDING_DELETE_CONFIRMATION,
DomainStatus::PENDING_DELETE_CONFIRMATION, DomainStatus::PENDING_CREATE, DomainStatus::PENDING_UPDATE,
DomainStatus::PENDING_CREATE, DomainStatus::PENDING_DELETE, DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_UPDATE, DomainStatus::PENDING_TRANSFER, DomainStatus::FORCE_DELETE
DomainStatus::PENDING_DELETE,
DomainStatus::PENDING_RENEW,
DomainStatus::PENDING_TRANSFER,
DomainStatus::FORCE_DELETE,
]).empty? ]).empty?
end end

View file

@ -72,16 +72,14 @@ class DomainPresenter
end end
end end
def remove_registry_lock_btn def remove_registry_lock_btn
if domain.locked_by_registrant? return unless domain.locked_by_registrant?
view.link_to(view.t('admin.domains.registry_lock_delete.btn'), view.link_to(view.t('admin.domains.registry_lock_delete.btn'),
view.admin_domain_registry_lock_path(domain), view.admin_domain_registry_lock_path(domain),
method: :delete, method: :delete,
data: { confirm: view.t('admin.domains.registry_lock_delete.confirm') }, data: { confirm: view.t('admin.domains.registry_lock_delete.confirm') },
class: 'dropdown-item') class: 'dropdown-item')
end end
end
private private