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

remove the attribute name and colon to make it consistant with other error texts

bsatarnejad7044ddb84231
diff --git a/app/contracts/work_packages/base_contract.rb b/app/contracts/work_packages/base_contract.rb
index 2e40ac1bf46..194be99ee56 100644
--- a/app/contracts/work_packages/base_contract.rb
+++ b/app/contracts/work_packages/base_contract.rb
@@ -325,9 +325,9 @@ module WorkPackages
return if id.nil? || model.changed.exclude?(id_attribute)
unless principal_visible?(id, list)
- errors.add attribute,
- ": #{I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
- property: I18n.t("attributes.#{attribute}"))}"
+ errors.add :base,
+ I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
+ property: I18n.t("attributes.#{attribute}"))
end
end
diff --git a/spec/contracts/work_packages/shared_base_contract.rb b/spec/contracts/work_packages/shared_base_contract.rb
index aab9f50d3fc..fe150ab1daa 100644
--- a/spec/contracts/work_packages/shared_base_contract.rb
+++ b/spec/contracts/work_packages/shared_base_contract.rb
@@ -81,8 +81,8 @@ shared_examples_for 'work package contract' do
context 'if the assigned user is not a possible assignee' do
it 'is not a valid assignee' do
- error = ": #{I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
- property: I18n.t('attributes.assignee'))}"
+ error = I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
+ property: I18n.t('attributes.assignee'))
expect(validated_contract.errors[:assigned_to]).to match_array [error]
end
end
@@ -107,8 +107,8 @@ shared_examples_for 'work package contract' do
context 'if the assigned user is not a possible responsible' do
it 'is not a valid responsible' do
- error = ": #{I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
- property: I18n.t('attributes.responsible'))}"
+ error = I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
+ property: I18n.t('attributes.responsible'))
expect(validated_contract.errors[:responsible]).to match_array [error]
end
end