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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
chore[Op#40437]: remap model validations names to be more suitable
Kabiru Mwenja54c0ff631d93
diff --git a/app/contracts/emoji_reactions/base_contract.rb b/app/contracts/emoji_reactions/base_contract.rbindex 6474099506a..4de709e0d1d 100644--- a/app/contracts/emoji_reactions/base_contract.rb+++ b/app/contracts/emoji_reactions/base_contract.rb@@ -43,15 +43,15 @@ module EmojiReactionsprivatedef validate_user_exists- errors.add :user, :error_not_found unless User.exists?(model.user_id)+ errors.add :user, :not_found unless User.exists?(model.user_id)enddef validate_acting_user- errors.add :user, :error_unauthorized unless model.user_id == user.id+ errors.add :user, :invalid unless model.user_id == user.idenddef validate_reactable_exists- errors.add :reactable, :error_not_found if model.reactable.blank?+ errors.add :reactable, :not_found if model.reactable.blank?enddef manage_emoji_reactions_permission?diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 2f63b8ef6a0..5de5d229a93 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -943,7 +943,6 @@ en:could_not_be_copied: "%{dependency} could not be (fully) copied."does_not_exist: "does not exist."error_enterprise_only: "%{action} is only available in the OpenProject Enterprise edition"- error_not_found: "not found."error_unauthorized: "may not be accessed."error_readonly: "was attempted to be written but is not writable."error_conflict: "Information has been updated by at least one other user in the meantime."@@ -968,6 +967,7 @@ en:not_available: "is not available due to a system configuration."not_deletable: "cannot be deleted."not_current_user: "is not the current user."+ not_found: "not found."not_a_date: "is not a valid date."not_a_datetime: "is not a valid date time."not_a_number: "is not a number."diff --git a/spec/contracts/emoji_reactions/base_contract_spec.rb b/spec/contracts/emoji_reactions/base_contract_spec.rbindex 435fd8919f6..332f85a9e74 100644--- a/spec/contracts/emoji_reactions/base_contract_spec.rb+++ b/spec/contracts/emoji_reactions/base_contract_spec.rb@@ -71,7 +71,7 @@ RSpec.describe EmojiReactions::BaseContract docontext "when user does not exist" dobefore { allow(User).to receive(:exists?).with(user.id).and_return(false) }- it_behaves_like "contract is invalid", user: :error_not_found+ it_behaves_like "contract is invalid", user: :not_foundendend@@ -84,7 +84,7 @@ RSpec.describe EmojiReactions::BaseContract doemoji_reaction.user = different_userend- it_behaves_like "contract is invalid", user: :error_unauthorized+ it_behaves_like "contract is invalid", user: :invalidendend@@ -92,7 +92,7 @@ RSpec.describe EmojiReactions::BaseContract docontext "when reactable is blank" dobefore { emoji_reaction.reactable = nil }- it_behaves_like "contract is invalid", reactable: :error_not_found+ it_behaves_like "contract is invalid", reactable: :not_foundendcontext "when reactable is a work package" do@@ -110,14 +110,6 @@ RSpec.describe EmojiReactions::BaseContract doit_behaves_like "contract is valid"end-- context "when reactable is neither a journal nor a work package" do- let(:unknown_object) { build_stubbed(:project) }-- before { emoji_reaction.reactable = unknown_object }-- it_behaves_like "contract is invalid", base: :error_unauthorized- endendinclude_examples "contract reuses the model errors"