@@ -19,17 +19,15 class ContextMenusController < ApplicationController | |||||
19 | helper :watchers |
|
19 | helper :watchers | |
20 | helper :issues |
|
20 | helper :issues | |
21 |
|
21 | |||
|
22 | before_filter :find_issues, :only => :issues | |||
|
23 | ||||
22 | def issues |
|
24 | def issues | |
23 | @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project) |
|
|||
24 | (render_404; return) unless @issues.present? |
|
|||
25 | if (@issues.size == 1) |
|
25 | if (@issues.size == 1) | |
26 | @issue = @issues.first |
|
26 | @issue = @issues.first | |
27 | end |
|
27 | end | |
28 | @issue_ids = @issues.map(&:id).sort |
|
28 | @issue_ids = @issues.map(&:id).sort | |
29 |
|
29 | |||
30 | @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) |
|
30 | @allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&) | |
31 | @projects = @issues.collect(&:project).compact.uniq |
|
|||
32 | @project = @projects.first if @projects.size == 1 |
|
|||
33 |
|
31 | |||
34 | @can = {:edit => User.current.allowed_to?(:edit_issues, @projects), |
|
32 | @can = {:edit => User.current.allowed_to?(:edit_issues, @projects), | |
35 | :log_time => (@project && User.current.allowed_to?(:log_time, @project)), |
|
33 | :log_time => (@project && User.current.allowed_to?(:log_time, @project)), |
@@ -219,11 +219,9 class ContextMenusControllerTest < ActionController::TestCase | |||||
219 | assert_select 'a', :text => 'eCookbook - Shared' |
|
219 | assert_select 'a', :text => 'eCookbook - Shared' | |
220 | end |
|
220 | end | |
221 |
|
221 | |||
222 |
def test_context_menu_issue_ |
|
222 | def test_context_menu_with_issue_that_is_not_visible_should_fail | |
223 | get :issues, :ids => [1, 4] |
|
223 | get :issues, :ids => [1, 4] # issue 4 is not visible | |
224 |
assert_response |
|
224 | assert_response 302 | |
225 | assert_template 'context_menu' |
|
|||
226 | assert_equal [1], assigns(:issues).collect(&:id) |
|
|||
227 | end |
|
225 | end | |
228 |
|
226 | |||
229 | def test_should_respond_with_404_without_ids |
|
227 | def test_should_respond_with_404_without_ids |
General Comments 0
You need to be logged in to leave comments.
Login now