summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-11 18:33:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-11 18:33:06 +0000
commit60d2a5e322cb0da01dd5e372d004aa1b65a5280d (patch)
tree8065271506ba15df4c10e2df2a9bdb7ca3b5f21d
parent7371077fa27cfc7442a74be5e1c53b40fa6724d8 (diff)
downloadredmine-60d2a5e322cb0da01dd5e372d004aa1b65a5280d.tar.gz
redmine-60d2a5e322cb0da01dd5e372d004aa1b65a5280d.zip
Use #find_issues as before filter for issues context menu.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11961 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/controllers/context_menus_controller.rb6
-rw-r--r--test/functional/context_menus_controller_test.rb8
2 files changed, 5 insertions, 9 deletions
diff --git a/app/controllers/context_menus_controller.rb b/app/controllers/context_menus_controller.rb
index bc434ea12..d78ef3d3e 100644
--- a/app/controllers/context_menus_controller.rb
+++ b/app/controllers/context_menus_controller.rb
@@ -19,17 +19,15 @@ class ContextMenusController < ApplicationController
helper :watchers
helper :issues
+ before_filter :find_issues, :only => :issues
+
def issues
- @issues = Issue.visible.all(:conditions => {:id => params[:ids]}, :include => :project)
- (render_404; return) unless @issues.present?
if (@issues.size == 1)
@issue = @issues.first
end
@issue_ids = @issues.map(&:id).sort
@allowed_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
- @projects = @issues.collect(&:project).compact.uniq
- @project = @projects.first if @projects.size == 1
@can = {:edit => User.current.allowed_to?(:edit_issues, @projects),
:log_time => (@project && User.current.allowed_to?(:log_time, @project)),
diff --git a/test/functional/context_menus_controller_test.rb b/test/functional/context_menus_controller_test.rb
index 110fd7943..eeaa88f4b 100644
--- a/test/functional/context_menus_controller_test.rb
+++ b/test/functional/context_menus_controller_test.rb
@@ -219,11 +219,9 @@ class ContextMenusControllerTest < ActionController::TestCase
assert_select 'a', :text => 'eCookbook - Shared'
end
- def test_context_menu_issue_visibility
- get :issues, :ids => [1, 4]
- assert_response :success
- assert_template 'context_menu'
- assert_equal [1], assigns(:issues).collect(&:id)
+ def test_context_menu_with_issue_that_is_not_visible_should_fail
+ get :issues, :ids => [1, 4] # issue 4 is not visible
+ assert_response 302
end
def test_should_respond_with_404_without_ids