Feature #34700 ยป 0001-Allow-to-use-watch_by-filter-in-the-global-issues-li.patch
| app/models/query.rb | ||
|---|---|---|
| 615 | 615 | |
| 616 | 616 |
def watcher_values |
| 617 | 617 |
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)
|
|
| 619 | 619 |
watcher_values += |
| 620 | 620 |
principals.sort_by(&:status). |
| 621 | 621 |
collect{|s| [s.name, s.id.to_s, l("status_#{User::LABEL_BY_STATUS[s.status]}")]}
|
| test/functional/queries_controller_test.rb | ||
|---|---|---|
| 895 | 895 |
assert_include ["Dave2 Lopper2", "5", "locked"], json |
| 896 | 896 |
assert_include ["A Team", "10", "active"], json |
| 897 | 897 |
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 |
|
| 898 | 920 |
end |