mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️:event::append: Add visibility query support w/ option.
This commit is contained in:
parent
9efe14ba6d
commit
67448469ae
2 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue