Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

move errors from base to id, so it can be set as an inline validation

Behrokh Satarnejadef07bcc62436
diff --git a/app/controllers/work_package_children_relations_controller.rb b/app/controllers/work_package_children_relations_controller.rb
index d5c3cc45b02..37513176930 100644
--- a/app/controllers/work_package_children_relations_controller.rb
+++ b/app/controllers/work_package_children_relations_controller.rb
@@ -82,7 +82,7 @@ class WorkPackageChildrenRelationsController < ApplicationController
WorkPackages::UpdateService.new(user: current_user, model: child)
.call(parent:)
else
- child.errors.add(:base, I18n.t(:"activerecord.errors.models.work_package.lack_of_permission"))
+ child.errors.add(:id, :lack_of_permission)
ServiceResult.failure(result: child)
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e570b097cc4..a6e311866d0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1362,6 +1362,10 @@ en:
work_package:
is_not_a_valid_target_for_time_entries: "Work package #%{id} is not a valid target for reassigning the time entries."
attributes:
+ id:
+ format: "%{message}"
+ lack_of_permission: "Cannot add child because you don't have permissions to edit the selected work package."
+ blank: "ID can't be blank."
assigned_to:
format: "%{message}"
done_ratio:
@@ -1410,7 +1414,6 @@ en:
must_be_empty_when_work_is_empty_and_percent_complete_is_100p: >-
must be empty when Work is empty and % Complete is 100%.
readonly_status: "The work package is in a readonly status so its attributes cannot be changed."
- lack_of_permission: "Cannot add child because work package is read-only."
type:
attributes:
attribute_groups: