mirror of
https://github.com/discourse/discourse.git
synced 2025-04-11 15:10:55 +08:00
FIX: username autocomplete in assign modal wasn't working
This commit is contained in:
parent
5b96463c40
commit
daf1dda700
@ -706,8 +706,10 @@ class UsersController < ApplicationController
|
|||||||
Group.messageable(current_user)
|
Group.messageable(current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
to_render[:groups] = groups.where("name ILIKE :term_like", term_like: "#{term}%")
|
if groups
|
||||||
.map { |m| { name: m.name, full_name: m.full_name } }
|
to_render[:groups] = groups.where("name ILIKE :term_like", term_like: "#{term}%")
|
||||||
|
.map { |m| { name: m.name, full_name: m.full_name } }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
render json: to_render
|
render json: to_render
|
||||||
|
@ -175,6 +175,16 @@ RSpec.describe UsersController do
|
|||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't search for groups" do
|
||||||
|
get "/u/search/users.json", params: {
|
||||||
|
include_mentionable_groups: 'false',
|
||||||
|
include_messageable_groups: 'false'
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(JSON.parse(response.body)).not_to have_key(:groups)
|
||||||
|
end
|
||||||
|
|
||||||
it "searches for messageable groups" do
|
it "searches for messageable groups" do
|
||||||
get "/u/search/users.json", params: {
|
get "/u/search/users.json", params: {
|
||||||
include_mentionable_groups: 'false',
|
include_mentionable_groups: 'false',
|
||||||
@ -198,13 +208,21 @@ RSpec.describe UsersController do
|
|||||||
|
|
||||||
describe 'when not signed in' do
|
describe 'when not signed in' do
|
||||||
it 'should not include mentionable/messageable groups' do
|
it 'should not include mentionable/messageable groups' do
|
||||||
|
get "/u/search/users.json", params: {
|
||||||
|
include_mentionable_groups: 'false',
|
||||||
|
include_messageable_groups: 'false'
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(response).to be_success
|
||||||
|
expect(JSON.parse(response.body)).not_to have_key(:groups)
|
||||||
|
|
||||||
get "/u/search/users.json", params: {
|
get "/u/search/users.json", params: {
|
||||||
include_mentionable_groups: 'false',
|
include_mentionable_groups: 'false',
|
||||||
include_messageable_groups: 'true'
|
include_messageable_groups: 'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(JSON.parse(response.body)["groups"]).to eq(nil)
|
expect(JSON.parse(response.body)).not_to have_key(:groups)
|
||||||
|
|
||||||
get "/u/search/users.json", params: {
|
get "/u/search/users.json", params: {
|
||||||
include_messageable_groups: 'false',
|
include_messageable_groups: 'false',
|
||||||
@ -212,7 +230,7 @@ RSpec.describe UsersController do
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(response).to be_success
|
expect(response).to be_success
|
||||||
expect(JSON.parse(response.body)["groups"]).to eq(nil)
|
expect(JSON.parse(response.body)).not_to have_key(:groups)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user