discourse/app/serializers/found_user_serializer.rb
Andrei Prigorshnev 0ea5ae86ff
DEV: return user IDs on the user search route (#21206)
We call the `/u/search/users` URL when autocompleting users. It returns 
user's name, username and avatar template, but not user ID.

We need it to return user IDs in order to display user status in certain situations. 
I could add ID to FoundUserWithStatusSerializer, so it will be added only if 
user status is enabled in site settings. But I feel that it's good to always return it, 
it's not a lot of data comparing to what we already return, and it should be useful 
in other scenarios.
2023-04-25 18:25:57 +04:00

10 lines
195 B
Ruby

# frozen_string_literal: true
class FoundUserSerializer < ApplicationSerializer
attributes :id, :username, :name, :avatar_template
def include_name?
SiteSetting.enable_names?
end
end