From df39547fa1390c1bb4f9089b12e1bcaa6fd7d3e8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 14 Apr 2020 19:25:48 -0700 Subject: [PATCH] modules/client/sync/account_data: Fix return value from push_rules handler when no rules. --- modules/client/sync/account_data.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/client/sync/account_data.cc b/modules/client/sync/account_data.cc index 3d9b2647f..7a33bf255 100644 --- a/modules/client/sync/account_data.cc +++ b/modules/client/sync/account_data.cc @@ -167,7 +167,8 @@ ircd::m::sync::push_rules(data &data) content, "global" }; - const auto each_kind{[&_scope, &pushrules] + bool ret{false}; + const auto each_kind{[&_scope, &pushrules, &ret] (const string_view &scope, const string_view &kind) { json::stack::array _kind @@ -175,10 +176,11 @@ ircd::m::sync::push_rules(data &data) _scope, kind }; - pushrules.for_each(push::path{scope, kind, {}}, [&_kind] + pushrules.for_each(push::path{scope, kind, {}}, [&_kind, &ret] (const auto &event_idx, const auto &path, const json::object &rule) { _kind.append(rule); + ret |= true; return true; }); }}; @@ -188,5 +190,5 @@ ircd::m::sync::push_rules(data &data) each_kind("global", "room"); each_kind("global", "sender"); each_kind("global", "underride"); - return true; + return ret; }