Browse Source

CLDC-4332: Only show the check for wrong org on edit

pull/3305/head
samyou-softwire 3 weeks ago
parent
commit
50f358066f
  1. 2
      app/controllers/users_controller.rb

2
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")

Loading…
Cancel
Save