about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/admin/domain_blocks_controller.rb1
-rw-r--r--app/models/domain_block.rb9
2 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/admin/domain_blocks_controller.rb b/app/controllers/admin/domain_blocks_controller.rb
index 63c2f3eee..859bdd6d3 100644
--- a/app/controllers/admin/domain_blocks_controller.rb
+++ b/app/controllers/admin/domain_blocks_controller.rb
@@ -46,7 +46,6 @@ module Admin
     def update
       return destroy unless resource_params[:undo].to_i.zero?
       resource_params[:reason].strip! if resource_params[:reason].present?
-      resource_params[:processing] = true
       authorize @domain_block, :update?
       @domain_block.update(resource_params.except(:domain, :undo))
       if @domain_block.save
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 478095cb0..f7a87b443 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -29,6 +29,8 @@ class DomainBlock < ApplicationRecord
   scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
   scope :unprocessed, -> { where(processing: true) }
 
+  before_create :set_processing
+
   def self.blocked?(domain)
     where(domain: domain, severity: :suspend).exists?
   end
@@ -63,4 +65,11 @@ class DomainBlock < ApplicationRecord
   def undo
     return false
   end
+
+  private
+
+  def set_processing
+    return if processing
+    self.processing = true
+  end
 end