mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
Merge pull request #23366 from opf/fix/74928-numeric-id-instead-of-semantic-one-on-th
fix(ui): Numeric ID instead of semantic one on the error message on bulk edit (WP #74928)
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
error_count = erroneous_results.count
|
||||
total_count = service_result.dependent_results.map(&:result).uniq.count
|
||||
selected_count = selected_work_packages.count
|
||||
selected_ids = selected_work_packages.map(&:id)
|
||||
source_ids = erroneous_results.map { |call| call.state.copied_from_work_package_id }.compact.uniq
|
||||
source_work_packages_by_id = source_ids.any? ? WorkPackage.visible.where_display_id_in(*source_ids).index_by(&:id) : {}
|
||||
%>
|
||||
|
||||
<% if total_count - error_count == 0 %>
|
||||
@@ -31,10 +34,12 @@
|
||||
|
||||
<ul>
|
||||
<% erroneous_results.each do |call| %>
|
||||
<% wp_id = call.state.copied_from_work_package_id || call.result.id %>
|
||||
<% source_id = call.state.copied_from_work_package_id %>
|
||||
<% wp = source_id ? source_work_packages_by_id[source_id] : call.result %>
|
||||
<% wp_id = wp&.id || call.result.id %>
|
||||
|
||||
<li>
|
||||
<%= link_to "##{wp_id}", work_package_path(wp_id) %><%= selected_work_packages.map(&:id).include?(wp_id) ? "" : " (#{I18n.t('work_packages.bulk.descendant')})" %>:
|
||||
<%= link_to wp&.formatted_id || "##{wp_id}", work_package_path(wp) %><%= selected_ids.include?(wp_id) ? "" : " (#{I18n.t('work_packages.bulk.descendant')})" %>:
|
||||
<%= safe_join call.errors.full_messages, " " %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
@@ -616,6 +616,29 @@ RSpec.describe WorkPackages::BulkController, with_settings: { journal_aggregatio
|
||||
end
|
||||
end
|
||||
|
||||
context "with semantic identifiers",
|
||||
with_settings: { work_packages_identifier: "semantic" } do
|
||||
before do
|
||||
work_package1.update_columns(identifier: "PROJ-1", sequence_number: 1)
|
||||
work_package2.update_columns(identifier: "PROJ-2", sequence_number: 2)
|
||||
put :update,
|
||||
params: {
|
||||
ids: work_package_ids,
|
||||
work_package: { done_ratio: 150 }
|
||||
}
|
||||
end
|
||||
|
||||
it "shows semantic identifiers in the error flash" do
|
||||
expect(flash[:error]).to include("PROJ-1")
|
||||
expect(flash[:error]).to include("PROJ-2")
|
||||
end
|
||||
|
||||
it "does not show bare numeric ids in the error flash" do
|
||||
expect(flash[:error]).not_to include("##{work_package1.id}")
|
||||
expect(flash[:error]).not_to include("##{work_package2.id}")
|
||||
end
|
||||
end
|
||||
|
||||
describe "updating two children with dates to a new parent (Regression #28670)" do
|
||||
let(:task1) do
|
||||
create(:work_package,
|
||||
|
||||
Reference in New Issue
Block a user