0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 11:48:54 +02:00

ircd:Ⓜ️:push: Add tool to query if an action is notifying or not.

This commit is contained in:
Jason Volk 2020-03-22 19:41:53 -07:00
parent 2a301d6b2a
commit c4c1c47351
2 changed files with 31 additions and 0 deletions

View file

@ -28,6 +28,9 @@ namespace ircd::m::push
path make_path(const string_view &type, const string_view &state_key);
path make_path(const event &);
// true on "notify" or "coalesce"
bool notifying(const rule &);
extern log::log log;
}

View file

@ -562,6 +562,34 @@ ircd::m::push::rule::for_each(const path &path,
});
}
bool
ircd::m::push::notifying(const rule &rule)
{
const json::array &actions
{
json::get<"actions"_>(rule)
};
for(const string_view &action : actions)
{
if(json::type(action, std::nothrow) != json::STRING)
continue;
const json::string &string
{
action
};
if(string == "notify")
return true;
if(string == "coalesce")
return true;
}
return false;
}
//
// path
//