FIX: Show user filter hints when typing @ in search (#13799)

Will show the last 6 seen users as filtering suggestions when typing @ in quick search. (Previously the user suggestion required a character after the @.)

This also adds a default limit of 6 to the user search query, previously the backend was returning 20 results but a maximum of 6 results was being shown anyway.
This commit is contained in:
Penar Musaraj
2021-07-21 09:14:53 -04:00
committed by GitHub
parent 519528daa2
commit 2ce2c83bc9
7 changed files with 116 additions and 12 deletions

View File

@ -4022,6 +4022,24 @@ describe UsersController do
expect(json["users"].map { |u| u["name"] }).not_to include(staged_user.name)
end
end
context '`last_seen_users`' do
it "returns results when the param is true" do
get "/u/search/users.json", params: { last_seen_users: true }
json = response.parsed_body
expect(json["users"]).not_to be_empty
end
it "respects limit parameter at the same time" do
limit = 3
get "/u/search/users.json", params: { last_seen_users: true, limit: limit }
json = response.parsed_body
expect(json["users"]).not_to be_empty
expect(json["users"].size).to eq(limit)
end
end
end
describe '#email_login' do