mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 01:47:18 +02:00
115693873-job-initiator_added
This commit is contained in:
parent
24aec79ceb
commit
2f9a9bd680
5 changed files with 15 additions and 15 deletions
|
@ -5,7 +5,7 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
def update
|
def update
|
||||||
authorize! :update, :pending
|
authorize! :update, :pending
|
||||||
|
|
||||||
if registrant_verification.domain_registrant_change_confirm!
|
if registrant_verification.domain_registrant_change_confirm!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_applied)
|
||||||
else
|
else
|
||||||
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to edit_admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
@ -14,7 +14,7 @@ class Admin::PendingUpdatesController < AdminController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
authorize! :destroy, :pending
|
authorize! :destroy, :pending
|
||||||
if registrant_verification.domain_registrant_change_reject!
|
if registrant_verification.domain_registrant_change_reject!("admin #{current_user.username}")
|
||||||
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
redirect_to admin_domain_path(@domain.id), notice: t(:pending_removed)
|
||||||
else
|
else
|
||||||
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
redirect_to admin_domain_path(@domain.id), alert: t(:failure)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||||
domain_name: @domain.name,
|
domain_name: @domain.name,
|
||||||
verification_token: params[:token])
|
verification_token: params[:token])
|
||||||
if params[:rejected]
|
if params[:rejected]
|
||||||
if @registrant_verification.domain_registrant_change_reject!
|
if @registrant_verification.domain_registrant_change_reject!("email link #{current_user.username}")
|
||||||
flash[:notice] = t(:registrant_domain_verification_rejected)
|
flash[:notice] = t(:registrant_domain_verification_rejected)
|
||||||
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
|
redirect_to registrant_domain_update_confirm_path(@domain.id, rejected: true)
|
||||||
else
|
else
|
||||||
|
@ -29,7 +29,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
||||||
return render 'show'
|
return render 'show'
|
||||||
end
|
end
|
||||||
elsif params[:confirmed]
|
elsif params[:confirmed]
|
||||||
if @registrant_verification.domain_registrant_change_confirm!
|
if @registrant_verification.domain_registrant_change_confirm!("email link #{current_user.username}")
|
||||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||||
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class DomainDeleteConfirmJob < Que::Job
|
class DomainDeleteConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action, initiator)
|
||||||
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class DomainUpdateConfirmJob < Que::Job
|
class DomainUpdateConfirmJob < Que::Job
|
||||||
def run(domain_id, action)
|
def run(domain_id, action, initiator)
|
||||||
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
|
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action} by #{initiator}"
|
||||||
# it's recommended to keep transaction against job table as short as possible.
|
# it's recommended to keep transaction against job table as short as possible.
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
domain = Epp::Domain.find(domain_id)
|
domain = Epp::Domain.find(domain_id)
|
||||||
|
|
|
@ -13,27 +13,27 @@ class RegistrantVerification < ActiveRecord::Base
|
||||||
|
|
||||||
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
validates :verification_token, :domain_name, :domain, :action, :action_type, presence: true
|
||||||
|
|
||||||
def domain_registrant_change_confirm!
|
def domain_registrant_change_confirm!(initiator)
|
||||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||||
self.action = CONFIRMED
|
self.action = CONFIRMED
|
||||||
DomainUpdateConfirmJob.enqueue domain.id, CONFIRMED if save
|
DomainUpdateConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_change_reject!
|
def domain_registrant_change_reject!(initiator)
|
||||||
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
self.action_type = DOMAIN_REGISTRANT_CHANGE
|
||||||
self.action = REJECTED
|
self.action = REJECTED
|
||||||
DomainUpdateConfirmJob.run domain.id, REJECTED if save
|
DomainUpdateConfirmJob.run domain.id, REJECTED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_delete_confirm!
|
def domain_registrant_delete_confirm!(initiator)
|
||||||
self.action_type = DOMAIN_DELETE
|
self.action_type = DOMAIN_DELETE
|
||||||
self.action = CONFIRMED
|
self.action = CONFIRMED
|
||||||
DomainDeleteConfirmJob.enqueue domain.id, CONFIRMED if save
|
DomainDeleteConfirmJob.enqueue domain.id, CONFIRMED, initiator if save
|
||||||
end
|
end
|
||||||
|
|
||||||
def domain_registrant_delete_reject!
|
def domain_registrant_delete_reject!(initiator)
|
||||||
self.action_type = DOMAIN_DELETE
|
self.action_type = DOMAIN_DELETE
|
||||||
self.action = REJECTED
|
self.action = REJECTED
|
||||||
DomainDeleteConfirmJob.enqueue domain.id, REJECTED if save
|
DomainDeleteConfirmJob.enqueue domain.id, REJECTED, initiator if save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue