From 21bc6c4e9751960c6bff22b7faa7cf91d0d49a38 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 22 Feb 2023 14:16:55 -0800 Subject: [PATCH] ircd::m::rooms::summary: Ensure properties appear in /publicRooms response. --- matrix/rooms_summary.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/matrix/rooms_summary.cc b/matrix/rooms_summary.cc index 1340e7c25..b84cede96 100644 --- a/matrix/rooms_summary.cc +++ b/matrix/rooms_summary.cc @@ -372,7 +372,7 @@ ircd::m::rooms::summary::chunk_local(const m::room &room, state.get(std::nothrow, type, "") }; - m::get(std::nothrow, event_idx, "content", [&content_key, &closure] + return m::get(std::nothrow, event_idx, "content", [&content_key, &closure] (const json::object &content) { const json::string &value @@ -384,6 +384,13 @@ ircd::m::rooms::summary::chunk_local(const m::room &room, }); }}; + const auto required{[&query] + (const auto &type, const auto &content_key, const auto &closure) + { + if(!query(type, content_key, closure)) + closure(string_view{}); + }}; + // Aliases array { json::stack::member aliases_m{obj, "aliases"}; @@ -438,7 +445,7 @@ ircd::m::rooms::summary::chunk_local(const m::room &room, }); } - query("m.room.guest_access", "guest_access", [&obj] + required("m.room.guest_access", "guest_access", [&obj] (const string_view &value) { json::stack::member @@ -488,7 +495,7 @@ ircd::m::rooms::summary::chunk_local(const m::room &room, }; }); - query("m.room.history_visibility", "history_visibility", [&obj] + required("m.room.history_visibility", "history_visibility", [&obj] (const string_view &value) { json::stack::member