0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-24 12:58:21 +02:00

ircd:Ⓜ️:event::append: Add visibility query support w/ option.

This commit is contained in:
Jason Volk 2020-12-28 00:56:45 -08:00
parent 9efe14ba6d
commit 67448469ae
2 changed files with 13 additions and 0 deletions

View file

@ -50,6 +50,7 @@ struct ircd::m::event::append::opts
bool query_txnid {true};
bool query_prev_state {true};
bool query_redacted {true};
bool query_visible {false};
};
inline

View file

@ -104,6 +104,18 @@ ircd::m::event::append::append(json::stack::object &object,
if(opts.event_filter && !m::match(*opts.event_filter, event))
return false;
if(opts.query_visible && opts.user_id && !visible(event, *opts.user_id))
{
log::debug
{
log, "Not sending event %s because not visible to %s.",
string_view{event.event_id},
string_view{*opts.user_id},
};
return false;
}
const bool has_event_idx
{
opts.event_idx && *opts.event_idx