From c995be94d972a7d80345c265509bdc02ed168cb0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 24 Apr 2007 15:19:49 +0000 Subject: [PATCH] Fixed: default status not showing in new issue git-svn-id: http://redmine.rubyforge.org/svn/trunk@475 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 2 +- app/models/issue_status.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 494c2313..19f93de9 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -216,7 +216,7 @@ class ProjectsController < ApplicationController default_status = IssueStatus.default @issue = Issue.new(:project => @project, :tracker => @tracker) @issue.status = default_status - @allowed_statuses = (default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) || [default_status])if logged_in_user + @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker))if logged_in_user if request.get? @issue.start_date = Date.today @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } diff --git a/app/models/issue_status.rb b/app/models/issue_status.rb index 30a96f4e..cea77132 100644 --- a/app/models/issue_status.rb +++ b/app/models/issue_status.rb @@ -39,7 +39,7 @@ class IssueStatus < ActiveRecord::Base # Uses association cache when called more than one time def new_statuses_allowed_to(role, tracker) new_statuses = workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker - new_statuses.sort{|x, y| x.position <=> y.position } if new_statuses + new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : [] end # Same thing as above but uses a database query @@ -48,7 +48,7 @@ class IssueStatus < ActiveRecord::Base new_statuses = workflows.find(:all, :include => :new_status, :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker - new_statuses.sort{|x, y| x.position <=> y.position } if new_statuses + new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : [] end private