Do not raise error in AutocompleteController#users when not authorized

https://gitlab.com/gitlab-org/gitlab-ce/issues/25031
This commit is contained in:
Semyon Pupkov 2016-11-29 14:49:43 +05:00
parent 4a3a413161
commit f5e8337c7b
3 changed files with 14 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class AutocompleteController < ApplicationController
@users = @users.reorder(:name)
@users = @users.page(params[:page])
if params[:todo_filter].present?
if params[:todo_filter].present? && current_user
@users = @users.todo_authors(current_user.id, params[:todo_state_filter])
end

View File

@ -0,0 +1,4 @@
---
title: Do not raise error in AutocompleteController#users when not authorized
merge_request: 7817
author: Semyon Pupkov

View File

@ -144,6 +144,15 @@ describe AutocompleteController do
it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 0 }
end
describe 'GET #users with todo filter' do
it 'gives an array of users' do
get :users, todo_filter: true
expect(response.status).to eq 200
expect(body).to be_kind_of(Array)
end
end
end
context 'author of issuable included' do