Defect #43804
openCustom field preview does not work on bulk issue edit
Description
The preview for custom fields does not work on the bulk issue edit screen.
Steps to reproduce
1. Create a custom field. Set the format to Long text, and enable Text formatting and Full width text.
2. Access /issues and select multiple issues from different projects.
3. Choose Bulk edit from the context menu.
4. Enter text into the custom field, then click the Preview tab. The content is not displayed.
PreviewsController#issue expects project_id, but project_id is not sent from the bulk edit preview request.
As a result, the preview request returns 404, and the preview is not displayed.
Files
Updated by Kenta Kumojima 21 days ago
- File fix_preview_path.patch fix_preview_path.patch added
This patch changes the custom field preview to use preview_text_path, in the same way as comments.
Updated by Go MAEDA 19 days ago
Thank you for reporting this issue.
I found that this patch introduces a regression in existing behavior. During bulk edit within a single project, project-scoped wiki syntax is no longer rendered correctly in preview. For example, links that depend on @project, such as [[Another_page]] and version:"2.0", are not linkified.
To fix this, I suggest continuing to use preview_issue_path, and falling back to preview_text_path only when @project is not set.
diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb
index 6adc5a0ef..7b70ae1be 100644
--- a/app/views/issues/bulk_edit.html.erb
+++ b/app/views/issues/bulk_edit.html.erb
@@ -213,7 +213,8 @@
<label><%= custom_field.name %></label>
<%= custom_field_tag_for_bulk_edit('issue', custom_field, @issues, @issue_params[:custom_field_values][custom_field.id.to_s]) %>
</p>
- <%= wikitoolbar_for "issue_custom_field_values_#{custom_field.id}", preview_issue_path(:project_id => @project, :issue_id => nil) if custom_field.full_text_formatting? %>
+ <% preview_url = @project ? preview_issue_path(:project_id => @project, :issue_id => nil) : preview_text_path %>
+ <%= wikitoolbar_for "issue_custom_field_values_#{custom_field.id}", preview_url if custom_field.full_text_formatting? %>
<% end %>
</fieldset>
Updated by Kenta Kumojima 19 days ago
Go MAEDA wrote in #note-3:
To fix this, I suggest continuing to use
preview_issue_path, and falling back topreview_text_pathonly when@projectis not set.
Thank you for your feedback. I agree that your proposed patch is a better approach.