mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
modules/client/user: Reactivate the get filter endpoint.
This commit is contained in:
parent
b86560c5f5
commit
bbbb88fe46
2 changed files with 12 additions and 24 deletions
|
@ -26,6 +26,7 @@ ircd::m::filter::filter(const string_view &filter_id,
|
|||
const mutable_buffer &buf)
|
||||
{
|
||||
size_t len{0};
|
||||
//TODO: really has to become event in user's room
|
||||
filters.get("ircd.filter"_sv, filter_id, [&buf, &len]
|
||||
(const m::event &event)
|
||||
{
|
||||
|
|
|
@ -32,35 +32,22 @@ get_filter(client &client, const resource::request &request)
|
|||
request.parv[2]
|
||||
};
|
||||
|
||||
const m::vm::query<m::vm::where::equal> query
|
||||
//TODO: ??
|
||||
const unique_buffer<mutable_buffer> buffer
|
||||
{
|
||||
{ "room_id", m::filter::filters.room_id },
|
||||
{ "type", "ircd.filter" },
|
||||
{ "state_key", filter_id },
|
||||
{ "sender", user_id },
|
||||
m::filter::size(filter_id)
|
||||
};
|
||||
|
||||
const auto result{[&client]
|
||||
(const m::event &event)
|
||||
//TODO: get direct
|
||||
const m::filter filter
|
||||
{
|
||||
const json::object &filter
|
||||
{
|
||||
json::at<"content"_>(event)
|
||||
};
|
||||
filter_id, buffer
|
||||
};
|
||||
|
||||
resource::response
|
||||
{
|
||||
client, filter
|
||||
};
|
||||
|
||||
return true;
|
||||
}};
|
||||
|
||||
if(!m::vm::test(query, result))
|
||||
throw m::NOT_FOUND("No matching filter with that ID");
|
||||
|
||||
// Response already made
|
||||
return {};
|
||||
return resource::response
|
||||
{
|
||||
client, json::object{buffer}
|
||||
};
|
||||
}
|
||||
|
||||
resource::method get_method
|
||||
|
|
Loading…
Reference in a new issue