From 50f358066f2c65480b91fc393cd8d160544d4bce Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Tue, 14 Apr 2026 16:41:25 +0100 Subject: [PATCH] CLDC-4332: Only show the check for wrong org on edit --- app/controllers/users_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d75f82438..57ef2c04f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -224,7 +224,7 @@ private if user_params.key?(:organisation_id) if user_params[:organisation_id].blank? @user.errors.add :organisation_id, :blank - elsif !@user.role_is_allowed_to_be_in_organisation?(override_organisation_id: user_params[:organisation_id].to_i) + elsif !@user.role_is_allowed_to_be_in_organisation?(override_organisation_id: user_params[:organisation_id].to_i) && @user.id != nil # this will also be flagged by the validation in user.rb. # for convenience we show the error early before they go through the change org flow (involves reassigning logs). @user.errors.add :organisation_id, I18n.t("validations.user.support_user_in_wrong_organisation.change_organisation")