Commit f5e8337c authored by Semyon Pupkov's avatar Semyon Pupkov

Do not raise error in AutocompleteController#users when not authorized

https://gitlab.com/gitlab-org/gitlab-ce/issues/25031
parent 4a3a4131
...@@ -11,7 +11,7 @@ class AutocompleteController < ApplicationController ...@@ -11,7 +11,7 @@ class AutocompleteController < ApplicationController
@users = @users.reorder(:name) @users = @users.reorder(:name)
@users = @users.page(params[:page]) @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]) @users = @users.todo_authors(current_user.id, params[:todo_state_filter])
end end
......
---
title: Do not raise error in AutocompleteController#users when not authorized
merge_request: 7817
author: Semyon Pupkov
...@@ -144,6 +144,15 @@ describe AutocompleteController do ...@@ -144,6 +144,15 @@ describe AutocompleteController do
it { expect(body).to be_kind_of(Array) } it { expect(body).to be_kind_of(Array) }
it { expect(body.size).to eq 0 } it { expect(body.size).to eq 0 }
end 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 end
context 'author of issuable included' do context 'author of issuable included' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment