Defect #36444
open
Validation error message when no trackers are assigned to a project is confusing
Added by Go MAEDA almost 3 years ago.
Updated about 2 years ago.
Description
Assume that you are trying to create an issue via email. If no tracker is associated to the target project, the issue creation will fail and you will see a validation error in production.log as follows.
MailHandler: Validation failed: Validation failed: Tracker cannot be blank, Status cannot be blank
Probably it is difficult for most users to understand that the cause of the error is that no tracker is assigned to the project by seeing the error above. I think the error message needs some improvement.
The following change improves the validation error message. After applying it, the error message will be like this:
Validation failed: Tracker cannot be blank, Status cannot be blank, No tracker is associated to this project. Please check the Project settings.
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 02aaff33b..8cc1ad66e 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -798,6 +798,11 @@ class Issue < ActiveRecord::Base
end
end
end
+
+ # Checks the project has associated trackers
+ if project && project.trackers.empty?
+ errors.add :base, I18n.t(:error_no_tracker_in_project)
+ end
end
# Validates the issue against additional workflow requirements
- Subject changed from The error message when no trackers are assigned to a project is confusing to Validation error message when no trackers are assigned to a project is confusing
- Target version set to Candidate for next major release
Also available in: Atom
PDF