From 2d47d6b4f8c4309189704c2748ea92eeeaff6c4d Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 2 Feb 2022 17:47:45 +0000 Subject: [PATCH] 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 --- app/models/user.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.43.2