Project

General

Profile

Actions

Patch #41173

open

Default project in generic new issue page is the oldest created one

Added by salman mp about 2 months ago.

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

0%

Estimated time:

Description

As Sebastian Paluch told in Feature #16067-5: Generic New Issue page:

The only issue with current solution is that when navigated to https://redmine.host/issues/new the issue Project is defaulted to
@issue.project ||= @issue.allowed_target_projects.first
This is not ideal, as we really need user to choose right project.

This is a small change to replace the oldest created project with the first alphabetically listed project.


diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
--- a/app/controllers/issues_controller.rb    (revision 41804:94cb08cd65eb27ef693ca8144836553a3c3183ab)
+++ b/app/controllers/issues_controller.rb    (revision 41804+:94cb08cd65eb+)
@@ -571,7 +571,7 @@
     end
     @issue.project = @project
     if request.get?
-      @issue.project ||= @issue.allowed_target_projects.first
+      @issue.project ||= @issue.allowed_target_projects.order(name: :asc).first
     end
     @issue.author ||= User.current
     @issue.start_date ||= User.current.today if Setting.default_issue_start_date_to_creation_date?

Another suggestion may be replacing name by identifier.
This gives admin the ability of changing the order of projects for being selected as default.

No data to display

Actions

Also available in: Atom PDF