mirror of
https://github.com/matrix-construct/construct
synced 2024-11-18 16:00:57 +01:00
modules/federation/query: Respond with full profile when no field query parameter.
This commit is contained in:
parent
81127045b0
commit
aa6b8352da
1 changed files with 39 additions and 9 deletions
|
@ -85,8 +85,7 @@ get__query_profile(client &client,
|
||||||
|
|
||||||
const string_view field
|
const string_view field
|
||||||
{
|
{
|
||||||
//TODO: XXX full profile aggregation w/ user:: linkage
|
request.query["field"]
|
||||||
request.query.at("field")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const m::user user
|
const m::user user
|
||||||
|
@ -99,19 +98,50 @@ get__query_profile(client &client,
|
||||||
user
|
user
|
||||||
};
|
};
|
||||||
|
|
||||||
profile.get(field, [&client]
|
if(!empty(field))
|
||||||
(const string_view &field, const string_view &value)
|
|
||||||
{
|
{
|
||||||
resource::response
|
profile.get(field, [&client]
|
||||||
|
(const string_view &field, const string_view &value)
|
||||||
{
|
{
|
||||||
client, json::members
|
resource::response
|
||||||
{
|
{
|
||||||
{ field, value }
|
client, json::members
|
||||||
}
|
{
|
||||||
|
{ field, value }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
resource::response::chunked response
|
||||||
|
{
|
||||||
|
client, http::OK
|
||||||
|
};
|
||||||
|
|
||||||
|
json::stack out
|
||||||
|
{
|
||||||
|
response.buf, response.flusher()
|
||||||
|
};
|
||||||
|
|
||||||
|
json::stack::object top
|
||||||
|
{
|
||||||
|
out
|
||||||
|
};
|
||||||
|
|
||||||
|
profile.for_each([&top]
|
||||||
|
(const string_view &key, const string_view &val)
|
||||||
|
{
|
||||||
|
json::stack::member
|
||||||
|
{
|
||||||
|
top, key, val
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {}; // responded from closure
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
resource::response
|
resource::response
|
||||||
|
|
Loading…
Reference in a new issue