Patch #32522
openAdd Project.find_by_name to target_project
0%
Description
Consider issue #6694, fix is trivial. Think about all those reporters who struggle to memorizing all that ID stuff.
File app/models/mail_handler.rb
Line 410
target = get_project_from_receiver_addresses
target ||= Project.find_by_identifier(get_keyword(:project))
target ||= Project.find_by_name(get_keyword(:project)) # just one new line
Related issues
Updated by Go MAEDA about 5 years ago
- Is duplicate of Defect #6694: Bug in project name when create issue by email added
Updated by Go MAEDA about 5 years ago
Since project names may not be unique, I think we cannot add the suggested code.
Updated by Keks Keksov about 5 years ago
Well, it's a good point. But then we have two options:
1. Mark Project.find_by_name as a deprecated/potentially-dangerous method and eliminate it in future versions of RM "Since project names may not be unique".
2. Implement some system-wide option "Enforce unique project names" and if it's disabled (users may create projects with non-unique names) then find_by_name method should throw an exception telling something like this: "Either you force unique names at settings page of your project or don't use Project.find_by_name in your code"
By the way,
root@sd-srv-redmine-01:/opt/redmine/app# grep -r find_by_name
helpers/application_helper.rb: link_project = Project.find_by_identifier(identifier) || Project.find_by_name(identifier)
models/wiki.rb: project = Project.find_by_identifier(project_identifier) || Project.find_by_name(project_identifier)
Updated by Mischa The Evil about 5 years ago
- Related to Feature #630: Allow non-unique names for projects added