##// 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 return
148 return
149 end
149 end
150 @issue.status = default_status
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 if request.get? || request.xhr?
153 if request.get? || request.xhr?
154 @issue.start_date ||= Date.today
154 @issue.start_date ||= Date.today
@@ -312,9 +312,10 class Issue < ActiveRecord::Base
312 end
312 end
313
313
314 # Returns an array of status that user is able to apply
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 statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker)
316 statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker)
317 statuses << status unless statuses.empty?
317 statuses << status unless statuses.empty?
318 statuses << IssueStatus.default if include_default
318 statuses = statuses.uniq.sort
319 statuses = statuses.uniq.sort
319 blocked? ? statuses.reject {|s| s.is_closed?} : statuses
320 blocked? ? statuses.reject {|s| s.is_closed?} : statuses
320 end
321 end
General Comments 0
You need to be logged in to leave comments. Login now