about summary refs log tree commit diff
path: root/app/controllers/api/v1/admin
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-12-15 17:45:02 +0100
committerGitHub <noreply@github.com>2022-12-15 17:45:02 +0100
commit8556a649d58a7291db6942a2594533f9b8c06165 (patch)
tree8617e90f84082e8ba35160f8b2a3772812216a4f /app/controllers/api/v1/admin
parent1e49be33289b969be64620b904d589158e7b579a (diff)
Fix changing domain block severity not undoing individual account effects (#22135)
* Fix changing domain block severity not undoing individual account effects

Fixes #22133

* Add tests
Diffstat (limited to 'app/controllers/api/v1/admin')
-rw-r--r--app/controllers/api/v1/admin/domain_blocks_controller.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/controllers/api/v1/admin/domain_blocks_controller.rb b/app/controllers/api/v1/admin/domain_blocks_controller.rb
index df5b1b3fc..8b77e9717 100644
--- a/app/controllers/api/v1/admin/domain_blocks_controller.rb
+++ b/app/controllers/api/v1/admin/domain_blocks_controller.rb
@@ -40,10 +40,8 @@ class Api::V1::Admin::DomainBlocksController < Api::BaseController
 
   def update
     authorize @domain_block, :update?
-    @domain_block.update(domain_block_params)
-    severity_changed = @domain_block.severity_changed?
-    @domain_block.save!
-    DomainBlockWorker.perform_async(@domain_block.id, severity_changed)
+    @domain_block.update!(domain_block_params)
+    DomainBlockWorker.perform_async(@domain_block.id, @domain_block.severity_previously_changed?)
     log_action :update, @domain_block
     render json: @domain_block, serializer: REST::Admin::DomainBlockSerializer
   end