mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Only show currently visible projects in the project jump box (#34595).
Patch by Holger Just and Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20803 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1accf2a072
commit
124c94df94
@ -31,6 +31,7 @@ module Redmine
|
|||||||
def recently_used_projects
|
def recently_used_projects
|
||||||
project_ids = recently_used_project_ids
|
project_ids = recently_used_project_ids
|
||||||
Project.where(id: project_ids).
|
Project.where(id: project_ids).
|
||||||
|
visible.
|
||||||
index_by(&:id).
|
index_by(&:id).
|
||||||
values_at(*project_ids). # sort according to stored order
|
values_at(*project_ids). # sort according to stored order
|
||||||
compact
|
compact
|
||||||
|
|||||||
@ -23,7 +23,8 @@ class Redmine::ProjectJumpBoxTest < ActiveSupport::TestCase
|
|||||||
fixtures :users, :projects, :user_preferences
|
fixtures :users, :projects, :user_preferences
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@user = User.find_by_login 'dlopper'
|
@user = User.find_by_login 'jsmith'
|
||||||
|
User.current = @user
|
||||||
@ecookbook = Project.find 'ecookbook'
|
@ecookbook = Project.find 'ecookbook'
|
||||||
@onlinestore = Project.find 'onlinestore'
|
@onlinestore = Project.find 'onlinestore'
|
||||||
end
|
end
|
||||||
@ -134,4 +135,16 @@ class Redmine::ProjectJumpBoxTest < ActiveSupport::TestCase
|
|||||||
assert_equal @onlinestore, pjb.recently_used_projects.first
|
assert_equal @onlinestore, pjb.recently_used_projects.first
|
||||||
assert_equal @ecookbook, pjb.recently_used_projects.last
|
assert_equal @ecookbook, pjb.recently_used_projects.last
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_recents_list_should_include_only_visible_projects
|
||||||
|
@user = User.find_by_login 'dlopper'
|
||||||
|
User.current = @user
|
||||||
|
|
||||||
|
pjb = Redmine::ProjectJumpBox.new @user
|
||||||
|
pjb.project_used @ecookbook
|
||||||
|
pjb.project_used @onlinestore
|
||||||
|
|
||||||
|
assert_equal 1, pjb.recently_used_projects.size
|
||||||
|
assert_equal @ecookbook, pjb.recently_used_projects.first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user