0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-26 08:42:34 +01:00

ircd:Ⓜ️:push: Add branch to handle other pattern key for content rules.

This commit is contained in:
Jason Volk 2020-03-23 19:32:01 -07:00
parent 6f17864cd7
commit 7861f77015

View file

@ -73,12 +73,20 @@ ircd::m::push::match::match(const event &event,
const match::opts &opts)
:boolean{[&event, &rule, &opts]
{
const auto &conditions
if(json::get<"pattern"_>(rule))
{
json::get<"conditions"_>(rule)
};
const push::cond cond
{
{ "kind", "event_match" },
{ "key", "content.body" },
{ "pattern", json::get<"pattern"_>(rule) },
};
for(const json::object &cond : conditions)
if(!match(event, cond, opts))
return false;
}
for(const json::object &cond : json::get<"conditions"_>(rule))
if(!match(event, push::cond(cond), opts))
return false;