From: Andy Allan Date: Wed, 2 Feb 2022 17:47:45 +0000 (+0000) Subject: Ensure that deactivate isn't available in production X-Git-Tag: live~1265^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/2d47d6b4f8c4309189704c2748ea92eeeaff6c4d Ensure that deactivate isn't available in production It's only used as a workaround for factories not being able to create pending users while keeping active as the default --- diff --git a/app/models/user.rb b/app/models/user.rb index cc12adecc..722d65302 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -172,8 +172,10 @@ class User < ApplicationRecord end # Used in test suite, not something that we would normally need to do. - event :deactivate do - transitions :from => :active, :to => :pending + if Rails.env.test? + event :deactivate do + transitions :from => :active, :to => :pending + end end # To confirm an account is used to override the spam scoring