@@ -216,7 +216,7 class ProjectsController < ApplicationController | |||
|
216 | 216 | default_status = IssueStatus.default |
|
217 | 217 | @issue = Issue.new(:project => @project, :tracker => @tracker) |
|
218 | 218 | @issue.status = default_status |
|
219 |
@allowed_statuses = (default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker) |
|
|
219 | @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker))if logged_in_user | |
|
220 | 220 | if request.get? |
|
221 | 221 | @issue.start_date = Date.today |
|
222 | 222 | @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue) } |
@@ -39,7 +39,7 class IssueStatus < ActiveRecord::Base | |||
|
39 | 39 | # Uses association cache when called more than one time |
|
40 | 40 | def new_statuses_allowed_to(role, tracker) |
|
41 | 41 | new_statuses = workflows.select {|w| w.role_id == role.id && w.tracker_id == tracker.id}.collect{|w| w.new_status} if role && tracker |
|
42 |
new_statuses.sort{|x, y| x.position <=> y.position } |
|
|
42 | new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : [] | |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | # Same thing as above but uses a database query |
@@ -48,7 +48,7 class IssueStatus < ActiveRecord::Base | |||
|
48 | 48 | new_statuses = workflows.find(:all, |
|
49 | 49 | :include => :new_status, |
|
50 | 50 | :conditions => ["role_id=? and tracker_id=?", role.id, tracker.id]).collect{ |w| w.new_status } if role && tracker |
|
51 |
new_statuses.sort{|x, y| x.position <=> y.position } |
|
|
51 | new_statuses ? new_statuses.sort{|x, y| x.position <=> y.position } : [] | |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | private |
General Comments 0
You need to be logged in to leave comments.
Login now