Defect #33183
Unable to edit user or group that has custom fields with text formatting enabled
Status: | Closed | Start date: | ||
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 0% | ||
Category: | Custom fields | |||
Target version: | 4.1.1 | |||
Resolution: | Fixed | Affected version: | 4.1.0 |
Description
Steps to reproduce:
1. Add a text format UserCustomField
2. Enable "Text formatting" for the custom field
3. Try to edit any user. You will see the Internal Server Error page
Completed 500 Internal Server Error in 145ms (ActiveRecord: 4.4ms) ActionView::Template::Error (undefined method `project' for #<User:0x00007fafaefe19a0> Did you mean? projects projects=): 18: <% end %> 19: 20: <% @user.custom_field_values.each do |value| %> 21: <p><%= custom_field_tag_with_label :user, value %></p> 22: <% end %> 23: 24: <p><%= f.check_box :admin, :disabled => (@user == User.current) %></p> app/helpers/custom_fields_helper.rb:89:in `custom_field_tag' app/helpers/custom_fields_helper.rb:120:in `custom_field_tag_with_label' app/views/users/_form.html.erb:21:in `block in _app_views_users__form_html_erb__1594929617543875487_70196358321500' app/views/users/_form.html.erb:20:in `each' app/views/users/_form.html.erb:20:in `_app_views_users__form_html_erb__1594929617543875487_70196358321500' app/views/users/_general.html.erb:2:in `block in _app_views_users__general_html_erb___1757341575386637995_70196280622620' app/helpers/application_helper.rb:1381:in `labelled_form_for' app/views/users/_general.html.erb:1:in `_app_views_users__general_html_erb___1757341575386637995_70196280622620' app/views/common/_tabs.html.erb:21:in `block in _app_views_common__tabs_html_erb__1281727382652852600_70196280567080' app/views/common/_tabs.html.erb:20:in `each' app/views/common/_tabs.html.erb:20:in `_app_views_common__tabs_html_erb__1281727382652852600_70196280567080' app/helpers/application_helper.rb:457:in `render_tabs' app/views/users/edit.html.erb:13:in `_app_views_users_edit_html_erb___3120376360499099218_70196265966740' lib/redmine/sudo_mode.rb:64:in `sudo_mode'
Related issues
Associated revisions
Unable to edit user or group that has custom fields with text formatting enabled (#33183).
Patch by Go MAEDA and Marius BALTEANU.
History
#2
Updated by Go MAEDA 11 months ago
- Related to Feature #31989: Inline issue auto complete (#) in fields with text-formatting enabled added
#3
Updated by Marius BALTEANU 11 months ago
- Assignee set to Marius BALTEANU
#4
Updated by Go MAEDA 11 months ago
The following code fixes the issue.
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index a6fbff9bd..26023ae94 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 && custom_value.customized.try(:project)
end
custom_value.custom_field.format.edit_tag(
self,
#5
Updated by Marius BALTEANU 11 months ago
- File test_for_33183.patch
added
- Assignee changed from Marius BALTEANU to Go MAEDA
- Target version set to 4.1.1
The fix looks good to me and I have attached a test case.
Thanks Go Maeda for detecting this issue.