プロジェクト

全般

プロフィール

Vote #80769

完了

Unable to edit user or group that has custom fields with text formatting enabled

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Custom fields_14
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
14
version_id:
160
issue_org_id:
33183
author_id:
332
assigned_to_id:
332
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

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 #
Did you mean?  projects
               projects=):
    18:   <% end %>
    19: 
    20:   <% @user.custom_field_values.each do |value| %>
    21:     

<%= custom_field_tag_with_label :user, value %>

22: <% end %> 23: 24:

<%= f.check_box :admin, :disabled => (@user == User.current) %>

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'

journals

This is due to r18444.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
The following code fixes the issue.

<pre><code class="diff">
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,
</code></pre>
--------------------------------------------------------------------------------
The fix looks good to me and I have attached a test case.

Thanks Go Maeda for detecting this issue.
--------------------------------------------------------------------------------
Committed the patch.
--------------------------------------------------------------------------------


related_issues

relates,Closed,31989,Inline issue auto complete (#) in fields with text-formatting enabled

Admin Redmine さんが3年以上前に更新

  • カテゴリCustom fields_14 にセット
  • 対象バージョン4.1.1_160 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0