Patch #32522

Add Project.find_by_name to target_project

Added by Keks Keksov about 1 year ago. Updated about 1 year ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-

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

Related to Redmine - Feature #630: Allow non-unique names for projects Closed 2008-02-11
Duplicates Redmine - Defect #6694: Bug in project name when create issue by email Closed 2010-10-18

History

#1 Updated by Go MAEDA about 1 year ago

  • Duplicates Defect #6694: Bug in project name when create issue by email added

#2 Updated by Go MAEDA about 1 year ago

Since project names may not be unique, I think we cannot add the suggested code.

#3 Updated by Keks Keksov about 1 year 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)

#4 Updated by Mischa The Evil about 1 year ago

  • Related to Feature #630: Allow non-unique names for projects added

Also available in: Atom PDF