##// END OF EJS Templates
Use #find_issues as before filter for issues context menu....
Jean-Philippe Lang -
r11731:60d2a5e322cb
parent child
Show More
@@ -19,17 +19,15 class ContextMenusController < ApplicationController
19 19 helper :watchers
20 20 helper :issues
21 21
22 before_filter :find_issues, :only => :issues
23
22 24 def issues
23 @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
24 (render_404; return) unless @issues.present?
25 25 if (@issues.size == 1)
26 26 @issue = @issues.first
27 27 end
28 28 @issue_ids = @issues.map(&:id).sort
29 29
30 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 32 @can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
35 33 :log_time => (@project && User.current.allowed_to?(:log_time, @project)),
@@ -219,11 +219,9 class ContextMenusControllerTest < ActionController::TestCase
219 219 assert_select 'a', :text => 'eCookbook - Shared'
220 220 end
221 221
222 def test_context_menu_issue_visibility
223 get :issues, :ids => [1, 4]
224 assert_response :success
225 assert_template 'context_menu'
226 assert_equal [1], assigns(:issues).collect(&:id)
222 def test_context_menu_with_issue_that_is_not_visible_should_fail
223 get :issues, :ids => [1, 4] # issue 4 is not visible
224 assert_response 302
227 225 end
228 226
229 227 def test_should_respond_with_404_without_ids
General Comments 0
You need to be logged in to leave comments. Login now