mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
modules/admin/rooms: Implement DELETE /forward_extremities.
This commit is contained in:
parent
cd78f802b2
commit
eb0a564d0b
1 changed files with 38 additions and 5 deletions
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
namespace ircd::m::admin
|
namespace ircd::m::admin
|
||||||
{
|
{
|
||||||
|
static resource::response handle_delete_forward_extremis(client &, const resource::request &, const room::id &);
|
||||||
static resource::response handle_get_forward_extremis(client &, const resource::request &, const room::id &);
|
static resource::response handle_get_forward_extremis(client &, const resource::request &, const room::id &);
|
||||||
static resource::response handle_get(client &, const resource::request &);
|
static resource::response handle(client &, const resource::request &);
|
||||||
|
|
||||||
extern resource::method get_method;
|
extern resource::method get_method;
|
||||||
|
extern resource::method delete_method;
|
||||||
extern resource rooms_resource;
|
extern resource rooms_resource;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,14 +38,23 @@ ircd::m::admin::rooms_resource
|
||||||
decltype(ircd::m::admin::get_method)
|
decltype(ircd::m::admin::get_method)
|
||||||
ircd::m::admin::get_method
|
ircd::m::admin::get_method
|
||||||
{
|
{
|
||||||
rooms_resource, "GET", handle_get,
|
rooms_resource, "GET", handle,
|
||||||
{
|
{
|
||||||
get_method.REQUIRES_OPER
|
get_method.REQUIRES_OPER
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
decltype(ircd::m::admin::delete_method)
|
||||||
|
ircd::m::admin::delete_method
|
||||||
|
{
|
||||||
|
rooms_resource, "DELETE", handle,
|
||||||
|
{
|
||||||
|
delete_method.REQUIRES_OPER
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
ircd::m::resource::response
|
ircd::m::resource::response
|
||||||
ircd::m::admin::handle_get(client &client,
|
ircd::m::admin::handle(client &client,
|
||||||
const resource::request &request)
|
const resource::request &request)
|
||||||
{
|
{
|
||||||
char buf[768];
|
char buf[768];
|
||||||
|
@ -66,7 +77,10 @@ ircd::m::admin::handle_get(client &client,
|
||||||
request.parv[1]
|
request.parv[1]
|
||||||
};
|
};
|
||||||
|
|
||||||
if(cmd == "forward_extremities")
|
if(request.head.method == "DELETE" && cmd == "forward_extremities")
|
||||||
|
return handle_delete_forward_extremis(client, request, room_id);
|
||||||
|
|
||||||
|
if(request.head.method == "GET" && cmd == "forward_extremities")
|
||||||
return handle_get_forward_extremis(client, request, room_id);
|
return handle_get_forward_extremis(client, request, room_id);
|
||||||
|
|
||||||
throw m::NOT_FOUND
|
throw m::NOT_FOUND
|
||||||
|
@ -75,6 +89,25 @@ ircd::m::admin::handle_get(client &client,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ircd::m::resource::response
|
||||||
|
ircd::m::admin::handle_delete_forward_extremis(client &client,
|
||||||
|
const resource::request &request,
|
||||||
|
const room::id &room_id)
|
||||||
|
{
|
||||||
|
const room::head room_head
|
||||||
|
{
|
||||||
|
room_id
|
||||||
|
};
|
||||||
|
|
||||||
|
return resource::response
|
||||||
|
{
|
||||||
|
client, http::OK, json::members
|
||||||
|
{
|
||||||
|
{ "deleted", long(room::head::reset(room_head)) }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
ircd::m::resource::response
|
ircd::m::resource::response
|
||||||
ircd::m::admin::handle_get_forward_extremis(client &client,
|
ircd::m::admin::handle_get_forward_extremis(client &client,
|
||||||
const resource::request &request,
|
const resource::request &request,
|
||||||
|
|
Loading…
Reference in a new issue