0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-26 13:58:18 +02:00

modules/client/rooms/context: Allow a room_id as the event_id and fetch the room head.

This commit is contained in:
Jason Volk 2019-03-01 19:01:21 -08:00
parent 0720b2f4c4
commit 7f7ecc90b3

View file

@ -55,9 +55,17 @@ get__context(client &client,
const resource::request &request, const resource::request &request,
const m::room::id &room_id) const m::room::id &room_id)
{ {
if(request.parv.size() < 3)
throw m::NEED_MORE_PARAMS
{
"event_id path parameter required"
};
m::event::id::buf event_id m::event::id::buf event_id
{ {
url::decode(event_id, request.parv[2]) m::sigil(request.parv[2]) == m::id::EVENT?
url::decode(event_id, request.parv[2]):
m::head(room_id)
}; };
const auto limit{[&request] const auto limit{[&request]