##// END OF EJS Templates
Refactor: use the existing Issue#new_statuses_allowed_to method....
Eric Davis -
r3419:976cba0c5d18
parent child
Show More
@@ -148,7 +148,7 class IssuesController < ApplicationController
148 148 return
149 149 end
150 150 @issue.status = default_status
151 @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.roles_for_project(@project), @issue.tracker)).uniq
151 @allowed_statuses = @issue.new_statuses_allowed_to(User.current, true)
152 152
153 153 if request.get? || request.xhr?
154 154 @issue.start_date ||= Date.today
@@ -312,9 +312,10 class Issue < ActiveRecord::Base
312 312 end
313 313
314 314 # Returns an array of status that user is able to apply
315 def new_statuses_allowed_to(user)
315 def new_statuses_allowed_to(user, include_default=false)
316 316 statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker)
317 317 statuses << status unless statuses.empty?
318 statuses << IssueStatus.default if include_default
318 319 statuses = statuses.uniq.sort
319 320 blocked? ? statuses.reject {|s| s.is_closed?} : statuses
320 321 end
General Comments 0
You need to be logged in to leave comments. Login now