mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
Disputes: Show when and who closed dispute
This commit is contained in:
parent
26a5813fe9
commit
c682155bf6
9 changed files with 48 additions and 31 deletions
|
@ -44,7 +44,7 @@ module Admin
|
|||
|
||||
# DELETE /admin/disputes/1
|
||||
def delete
|
||||
@dispute.close
|
||||
@dispute.close(initiator: 'Admin')
|
||||
redirect_to admin_disputes_url, notice: 'Dispute was successfully closed.'
|
||||
end
|
||||
|
||||
|
|
|
@ -31,10 +31,7 @@ class Registrant::DomainUpdateConfirmsController < RegistrantController
|
|||
end
|
||||
elsif params[:confirmed]
|
||||
if @registrant_verification.domain_registrant_change_confirm!("email link, #{initiator}")
|
||||
if @domain.disputed?
|
||||
dispute = Dispute.active.find_by(domain_name: @domain.name)
|
||||
dispute.close
|
||||
end
|
||||
Dispute.close_by_domain(@domain.name) if @domain.disputed?
|
||||
|
||||
flash[:notice] = t(:registrant_domain_verification_confirmed)
|
||||
redirect_to registrant_domain_update_confirm_path(@domain.id, confirmed: true)
|
||||
|
|
|
@ -13,7 +13,7 @@ class DisputeStatusUpdateJob < Que::Job
|
|||
end
|
||||
|
||||
def close_disputes
|
||||
disputes = Dispute.where(closed: false).where('expires_at < ?', Time.zone.today).all
|
||||
disputes = Dispute.where(closed: nil).where('expires_at < ?', Time.zone.today).all
|
||||
Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} closable disputes"
|
||||
disputes.each do |dispute|
|
||||
process_dispute(dispute, closing: true)
|
||||
|
@ -21,7 +21,7 @@ class DisputeStatusUpdateJob < Que::Job
|
|||
end
|
||||
|
||||
def activate_disputes
|
||||
disputes = Dispute.where(closed: false, starts_at: Time.zone.today).all
|
||||
disputes = Dispute.where(closed: nil, starts_at: Time.zone.today).all
|
||||
Rails.logger.info "DisputeStatusUpdateJob - Found #{disputes.count} activatable disputes"
|
||||
|
||||
disputes.each do |dispute|
|
||||
|
@ -31,7 +31,7 @@ class DisputeStatusUpdateJob < Que::Job
|
|||
|
||||
def process_dispute(dispute, closing: false)
|
||||
intent = closing ? 'close' : 'activate'
|
||||
success = closing ? dispute.close : dispute.generate_data
|
||||
success = closing ? dispute.close(initiator: 'Job') : dispute.generate_data
|
||||
create_backlog_entry(dispute: dispute, intent: intent, successful: success)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ class Dispute < ApplicationRecord
|
|||
|
||||
scope :expired, -> { where('expires_at < ?', Time.zone.today) }
|
||||
scope :active, lambda {
|
||||
where('starts_at <= ? AND expires_at >= ? AND closed = false', Time.zone.today, Time.zone.today)
|
||||
where('starts_at <= ? AND expires_at >= ? AND closed IS NULL', Time.zone.today, Time.zone.today)
|
||||
}
|
||||
scope :closed, -> { where(closed: true) }
|
||||
scope :closed, -> { where.not(closed: nil) }
|
||||
|
||||
attr_readonly :domain_name
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Dispute < ApplicationRecord
|
|||
dispute = Dispute.active.find_by(domain_name: domain_name)
|
||||
return false unless dispute
|
||||
|
||||
dispute.close
|
||||
dispute.close(initiator: 'Registrant')
|
||||
end
|
||||
|
||||
def self.valid_auth?(domain_name, password)
|
||||
|
@ -52,8 +52,8 @@ class Dispute < ApplicationRecord
|
|||
wr.save
|
||||
end
|
||||
|
||||
def close
|
||||
return false unless update(closed: true)
|
||||
def close(initiator: 'Unknown')
|
||||
return false unless update(closed: Time.zone.now, initiator: initiator)
|
||||
return if Dispute.active.where(domain_name: domain_name).any?
|
||||
|
||||
domain&.unmark_as_disputed
|
||||
|
@ -129,7 +129,7 @@ class Dispute < ApplicationRecord
|
|||
end
|
||||
|
||||
def validate_domain_name_period_uniqueness
|
||||
existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: false)
|
||||
existing_dispute = Dispute.unscoped.where(domain_name: domain_name, closed: nil)
|
||||
.where('expires_at >= ?', starts_at)
|
||||
|
||||
existing_dispute = existing_dispute.where.not(id: id) unless new_record?
|
||||
|
|
|
@ -125,13 +125,13 @@
|
|||
<%= sort_link(@q, 'name') %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'password') %>
|
||||
<%= sort_link(@q, 'Initiator') %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'starts_at') %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'expires_at') %>
|
||||
<%= sort_link(@q, 'Expired/Closed At') %>
|
||||
</th>
|
||||
<th class="col-xs-2">
|
||||
<%= sort_link(@q, 'comment') %>
|
||||
|
@ -145,13 +145,13 @@
|
|||
<%= x.domain_name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= x.password %>
|
||||
<%= x.initiator %>
|
||||
</td>
|
||||
<td>
|
||||
<%= x.starts_at %>
|
||||
</td>
|
||||
<td>
|
||||
<%= x.expires_at %>
|
||||
<%= x.closed %>
|
||||
</td>
|
||||
<td>
|
||||
<%= x.comment %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue