Project

General

Profile

Actions

Patch #32522

open

Add Project.find_by_name to target_project

Added by Keks Keksov over 4 years ago. Updated over 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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 projectsClosed2008-02-11

Actions
Is duplicate of Redmine - Defect #6694: Bug in project name when create issue by emailClosed2010-10-18

Actions
Actions #1

Updated by Go MAEDA over 4 years ago

  • Is duplicate of Defect #6694: Bug in project name when create issue by email added
Actions #2

Updated by Go MAEDA over 4 years ago

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

Actions #3

Updated by Keks Keksov over 4 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)

Actions #4

Updated by Mischa The Evil over 4 years ago

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

Also available in: Atom PDF