@@ -4,17 +4,11 class ContextMenusController < ApplicationController | |||
|
4 | 4 | |
|
5 | 5 | def issues |
|
6 | 6 | @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project) |
|
7 | ||
|
8 | 7 | if (@issues.size == 1) |
|
9 | 8 | @issue = @issues.first |
|
10 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current) | |
|
11 | else | |
|
12 | @allowed_statuses = @issues.map do |i| | |
|
13 | i.new_statuses_allowed_to(User.current) | |
|
14 | end.inject do |memo,s| | |
|
15 | memo & s | |
|
16 | end | |
|
17 | 9 | end |
|
10 | ||
|
11 | @allowed_statuses = @issues.map(&:new_statuses_allowed_to).inject{|memo,a| memo & a} | |
|
18 | 12 | @projects = @issues.collect(&:project).compact.uniq |
|
19 | 13 | @project = @projects.first if @projects.size == 1 |
|
20 | 14 |
@@ -510,7 +510,7 class Issue < ActiveRecord::Base | |||
|
510 | 510 | end |
|
511 | 511 | |
|
512 | 512 | # Returns an array of status that user is able to apply |
|
513 | def new_statuses_allowed_to(user, include_default=false) | |
|
513 | def new_statuses_allowed_to(user=User.current, include_default=false) | |
|
514 | 514 | statuses = status.find_new_statuses_allowed_to( |
|
515 | 515 | user.admin ? Role.all : user.roles_for_project(project), |
|
516 | 516 | tracker, |
General Comments 0
You need to be logged in to leave comments.
Login now