Fix styling issues

This commit is contained in:
Karl Erik Õunapuu 2020-04-27 12:32:55 +03:00
parent 2c8f1081c9
commit 39791f5755
5 changed files with 42 additions and 46 deletions

View file

@ -8,20 +8,8 @@ module Admin
# GET /admin/disputes
def index
params[:q] ||= {}
disputes = Dispute.active.all.order(:domain_name)
@q = disputes.search(params[:q])
@disputes = @q.result.page(params[:page])
if params[:results_per_page].to_i.positive?
@disputes = @disputes.per(params[:results_per_page])
end
closed_disputes = Dispute.closed.order(:domain_name)
@closed_q = closed_disputes.search(params[:closed_q])
@closed_disputes = @closed_q.result.page(params[:closed_page])
return unless params[:results_per_page].to_i.positive?
@closed_disputes = @closed_disputes.per(params[:results_per_page])
@disputes = sortable_dispute_query_for(Dispute.active.all, params[:q])
@closed_disputes = sortable_dispute_query_for(Dispute.closed.all, params[:q])
end
# GET /admin/disputes/1
@ -62,6 +50,14 @@ module Admin
private
def sortable_dispute_query_for(disputes, query)
@q = disputes.order(:domain_name).search(query)
disputes = @q.result.page(params[:page])
return disputes.per(params[:results_per_page]) if params[:results_per_page].present?
disputes
end
# Use callbacks to share common setup or constraints between actions.
def set_dispute
@dispute = Dispute.find(params[:id])

View file

@ -103,25 +103,18 @@ module Epp
def update
authorize! :update, @domain, @password
if @domain.update(params[:parsed_frame], current_user)
if @domain.disputed?
dispute = Dispute.active.find_by(domain_name: @domain.name)
dispute.close
end
if @domain.epp_pending_update.present?
render_epp_response '/epp/domains/success_pending'
else
render_epp_response '/epp/domains/success'
end
else
handle_errors(@domain)
end
updated = @domain.update(params[:parsed_frame], current_user)
(handle_errors(@domain) && return) unless updated
Dispute.active.close_by_domain(@domain.name) if @domain.disputed?
pending = @domain.epp_pending_update.present?
render_epp_response "/epp/domains/success#{'_pending' if pending}"
end
def delete
authorize! :delete, @domain, @password
handle_errors(@domain) and return unless @domain.can_be_deleted?
(handle_errors(@domain) && return) unless @domain.can_be_deleted?
if @domain.epp_destroy(params[:parsed_frame], current_user.id)
if @domain.epp_pending_delete.present?

View file

@ -4,6 +4,7 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
def show
return if params[:confirmed] || params[:rejected]
@domain = Domain.find(params[:id])
@domain = nil unless @domain.registrant_delete_confirmable?(params[:token])
end
@ -21,22 +22,23 @@ class Registrant::DomainDeleteConfirmsController < RegistrantController
initiator = current_registrant_user ? current_registrant_user.username :
t(:user_not_authenticated)
if params[:rejected]
if @registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
flash[:notice] = t(:registrant_domain_verification_rejected)
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true)
else
flash[:alert] = t(:registrant_domain_delete_rejected_failed)
return render 'show'
end
elsif params[:confirmed]
if @registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}")
flash[:notice] = t(:registrant_domain_verification_confirmed)
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true)
else
flash[:alert] = t(:registrant_domain_delete_confirmed_failed)
return render 'show'
end
confirmed = params[:confirmed] ? true : false
action = if confirmed
@registrant_verification.domain_registrant_delete_reject!("email link #{initiator}")
else
@registrant_verification.domain_registrant_delete_confirm!("email link #{initiator}")
end
fail_msg = t("registrant_domain_delete_#{confirmed ? 'confirmed' : 'rejected'}_failed".to_sym)
success_msg = t("registrant_domain_verification_#{confirmed ? 'confirmed' : 'rejected'}".to_sym)
flash[:alert] = action ? success_msg : fail_msg
(render 'show' && return) unless action
if confirmed
redirect_to registrant_domain_delete_confirm_path(@domain.id, confirmed: true) && return
else
redirect_to registrant_domain_delete_confirm_path(@domain.id, rejected: true) unless confirmed
end
end
end

View file

@ -20,6 +20,11 @@ class Dispute < ApplicationRecord
alias_attribute :name, :domain_name
def self.close_by_domain(domain_name)
dispute = Dispute.active.find_by(domain_name: domain_name)
dispute.update(closed: true) if dispute.present?
end
def set_expiry_date
return if starts_at.blank?

View file

@ -53,7 +53,7 @@ class Epp::Domain < Domain
def epp_code_map
{
'2002' => [ # Command use error
%i[base domain_already_belongs_to_the_querying_registrar]
%i[base domain_already_belongs_to_the_querying_registrar],
],
'2003' => [ # Required parameter missing
%i[registrant blank],
@ -86,7 +86,7 @@ class Epp::Domain < Domain
[:puny_label, :too_long, { obj: 'name', val: name_puny }]
],
'2201' => [ # Authorisation error
%i[transfer_code wrong_pw]
%i[transfer_code wrong_pw],
],
'2202' => [
%i[base invalid_auth_information_reserved],