From d449409ab9e68796984f95998330de6ba810ded6 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 24 Mar 2020 12:56:35 +0000 Subject: [PATCH] Unable to edit user or group that has custom fields with text formatting enabled (#33183). Patch by Go MAEDA and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19613 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/custom_fields_helper.rb | 2 +- test/functional/users_controller_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb index a6fbff9bd..5f5c057dc 100644 --- a/app/helpers/custom_fields_helper.rb +++ b/app/helpers/custom_fields_helper.rb @@ -86,7 +86,7 @@ module CustomFieldsHelper data = { :auto_complete => true, :issues_url => auto_complete_issues_path(:project_id => custom_value.customized.project, :q => '') - } if custom_value.customized && custom_value.customized.project + } if custom_value.customized&.try(:project) end custom_value.custom_field.format.edit_tag( self, diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index 591dad943..36ca9539f 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -454,6 +454,14 @@ class UsersControllerTest < Redmine::ControllerTest assert_response 404 end + def test_edit_user_with_full_text_formatting_custom_field_should_not_fail + field = UserCustomField.find(4) + field.update_attribute :text_formatting, 'full' + + get :edit, :params => {:id => 2} + assert_response :success + end + def test_update ActionMailer::Base.deliveries.clear put :update, :params => { -- 2.39.5