Skip to content

Commit f238663

Browse files
committed
Allow to use watch_by filter in the global issues list (#34700).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@20744 e93f8b46-1217-0410-a6f0-8f06a7374b81
1 parent af4c608 commit f238663

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/models/query.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def issue_statuses_values
615615

616616
def watcher_values
617617
watcher_values = [["<< #{l(:label_me)} >>", "me"]]
618-
if User.current.allowed_to?(:view_issue_watchers, self.project)
618+
if User.current.allowed_to?(:view_issue_watchers, self.project, global: true)
619619
watcher_values +=
620620
principals.sort_by(&:status).
621621
collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")]}

test/functional/queries_controller_test.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,26 @@ def test_watcher_filter_with_permission_should_show_members_and_groups
895895
assert_include ["Dave2 Lopper2", "5", "locked"], json
896896
assert_include ["A Team", "10", "active"], json
897897
end
898+
899+
def test_watcher_filter_with_permission_should_show_members_and_groups_globally
900+
# This user has view_issue_watchers permission
901+
@request.session[:user_id] = 1
902+
get(
903+
:filter,
904+
:params => {
905+
:type => 'IssueQuery',
906+
:name => 'watcher_id'
907+
}
908+
)
909+
assert_response :success
910+
assert_equal 'application/json', response.media_type
911+
json = ActiveSupport::JSON.decode(response.body)
912+
913+
assert_equal 8, json.count
914+
# "me" value should not be grouped
915+
assert_include ['<< me >>', 'me'], json
916+
assert_include ['Dave Lopper', '3', 'active'], json
917+
assert_include ['Dave2 Lopper2', '5', 'locked'], json
918+
assert_include ['A Team', '10', 'active'], json
919+
end
898920
end

0 commit comments

Comments
 (0)