Patch #33329 » 0002-Do-not-propose-watchers-that-are-not-allowed-to-see-.patch
| app/controllers/watchers_controller.rb | ||
|---|---|---|
|
users = scope.active.visible.sorted.like(params[:q]).to_a
|
||
|
users += scope_groups.active.visible.sorted.like(params[:q]).to_a
|
||
|
if @watchables && @watchables.size == 1
|
||
|
users -= @watchables.first.watcher_users
|
||
|
watchable_object = @watchables.first
|
||
|
users -= watchable_object.watcher_users
|
||
|
if watchable_object.respond_to?(:visible?)
|
||
|
users.reject! {|user| user.is_a?(User) && !watchable_object.visible?(user)}
|
||
|
end
|
||
|
end
|
||
|
users
|
||
|
end
|
||
| test/functional/watchers_controller_test.rb | ||
|---|---|---|
|
assert_not_include hidden.name, response.body
|
||
|
end
|
||
|
def test_autocomplete_for_user_should_not_return_users_without_object_visibility
|
||
|
@request.session[:user_id] = 1
|
||
|
get :autocomplete_for_user, :params => {
|
||
|
q: 'rober',
|
||
|
project_id: 'onlinestore',
|
||
|
object_id: '4',
|
||
|
object_type: 'issue'
|
||
|
}, :xhr => true
|
||
|
assert_response :success
|
||
|
assert response.body.blank?
|
||
|
end
|
||
|
def test_append
|
||
|
@request.session[:user_id] = 2
|
||
|
assert_no_difference 'Watcher.count' do
|
||