diff --git a/modules/client/pushrules.cc b/modules/client/pushrules.cc index b8d5cf72f..8e5603bc3 100644 --- a/modules/client/pushrules.cc +++ b/modules/client/pushrules.cc @@ -131,28 +131,9 @@ ircd::m::push::handle_get(client &client, }; const auto append_rule{[] - (json::stack::array &_kind, const auto &path, const json::object &rule) + (json::stack::array &array, const auto &path, const json::object &rule) { - const auto &[scope, kind, ruleid] - { - path - }; - - json::stack::object object - { - _kind - }; - - json::stack::member - { - object, "rule_id", ruleid - }; - - for(const auto &[key, val] : rule) - json::stack::member - { - object, key, val - }; + array.append(rule); }}; if(ruleid) @@ -343,6 +324,7 @@ ircd::m::push::handle_put(client &client, { { "enabled", rule.get("enabled", true) }, { "default", false }, + { "rule_id", ruleid }, }) }; diff --git a/modules/client/sync/account_data.cc b/modules/client/sync/account_data.cc index 087f74a41..565a310d7 100644 --- a/modules/client/sync/account_data.cc +++ b/modules/client/sync/account_data.cc @@ -176,25 +176,9 @@ ircd::m::sync::push_rules(data &data) }; pushrules.for_each(push::path{scope, kind, {}}, [&_kind] - (const auto &event_idx, const auto &path, const auto &members) + (const auto &event_idx, const auto &path, const json::object &rule) { - const auto &[scope, kind, ruleid] {path}; - json::stack::object object - { - _kind - }; - - json::stack::member - { - object, "rule_id", ruleid - }; - - for(const auto &[key, val] : members) - json::stack::member - { - object, key, val - }; - + _kind.append(rule); return true; }); }};