diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb index 46eba1abf..fa7caf4e0 100644 --- a/app/controllers/context_menus_controller.rb +++ b/app/controllers/context_menus_controller.rb @@ -4,17 +4,11 @@ class ContextMenusController < ApplicationController def issues @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project) - if (@issues.size == 1) @issue = @issues.first - @allowed_statuses = @issue.new_statuses_allowed_to(User.current) - else - @allowed_statuses = @issues.map do |i| - i.new_statuses_allowed_to(User.current) - end.inject do |memo,s| - memo & s - end end + + @allowed_statuses = @issues.map(&:new_statuses_allowed_to).inject{|memo,a| memo & a} @projects = @issues.collect(&:project).compact.uniq @project = @projects.first if @projects.size == 1 diff --git a/app/models/issue.rb b/app/models/issue.rb index 098113bdf..64a99e6be 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -510,7 +510,7 @@ class Issue < ActiveRecord::Base end # Returns an array of status that user is able to apply - def new_statuses_allowed_to(user, include_default=false) + def new_statuses_allowed_to(user=User.current, include_default=false) statuses = status.find_new_statuses_allowed_to( user.admin ? Role.all : user.roles_for_project(project), tracker,