From 601758f5fdd95f8994a67c0d8079376035de513d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Wed, 27 Sep 2023 13:29:35 -0400
Subject: [PATCH] proxy server: use isMember for timeout

---
 src/dht_proxy_server.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dht_proxy_server.cpp b/src/dht_proxy_server.cpp
index 4ac338d9..537c1f53 100644
--- a/src/dht_proxy_server.cpp
+++ b/src/dht_proxy_server.cpp
@@ -1080,6 +1080,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
             request->set_body(Json::writeString(jsonBuilder_, std::move(json)));
         } else {
             // NOTE: see https://github.com/appleboy/gorush
+            auto isResubscribe = json.isMember("timeout");
             Json::Value notification(Json::objectValue);
             Json::Value tokens(Json::arrayValue);
             tokens[0] = token;
@@ -1095,7 +1096,6 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
                 notification["expiration"] = exp;
                 if (!topic.empty())
                     notification["topic"] = topic;
-                auto isResubscribe = !notification["data"]["timeout"].isNull();
                 if (highPriority || isResubscribe) {
                     Json::Value alert(Json::objectValue);
                     alert["title"]="hello";
-- 
GitLab