From 976cba0c5d188ed8aa3dd756d634a3ee3a562177 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 4 Mar 2010 00:58:52 +0000 Subject: [PATCH] Refactor: use the existing Issue#new_statuses_allowed_to method. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3533 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 2 +- app/models/issue.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index aa28ebe8..6c71219b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -148,7 +148,7 @@ class IssuesController < ApplicationController return end @issue.status = default_status - @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq + @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true) if request.get? || request.xhr? @issue.start_date ||= Date.today diff --git a/app/models/issue.rb b/app/models/issue.rb index 92feaca8..d7b960ab 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -312,9 +312,10 @@ class Issue < ActiveRecord::Base end # Returns an array of status that user is able to apply - def new_statuses_allowed_to(user) + def new_statuses_allowed_to(user, include_default=false) statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker) statuses << status unless statuses.empty? + statuses << IssueStatus.default if include_default statuses = statuses.uniq.sort blocked? ? statuses.reject {|s| s.is_closed?} : statuses end