Ignore empty push payload.

GitOrigin-RevId: 6054ae0a7d7ae42bc14711efcc77d44fe2018a8d
This commit is contained in:
levlam 2019-03-25 01:07:35 +03:00
parent db927675bc
commit 0db8f14014

View File

@ -2230,7 +2230,7 @@ void NotificationManager::get_disable_contact_registered_notifications(Promise<U
} }
void NotificationManager::process_push_notification(string payload, Promise<Unit> &&promise) { void NotificationManager::process_push_notification(string payload, Promise<Unit> &&promise) {
if (is_disabled()) { if (is_disabled() || payload == "{}") {
promise.set_value(Unit()); promise.set_value(Unit());
return; return;
} }
@ -2269,6 +2269,10 @@ void NotificationManager::process_push_notification(string payload, Promise<Unit
} }
Result<int64> NotificationManager::get_push_receiver_id(string payload) { Result<int64> NotificationManager::get_push_receiver_id(string payload) {
if (payload == "{}") {
return static_cast<int64>(0);
}
auto r_json_value = json_decode(payload); auto r_json_value = json_decode(payload);
if (r_json_value.is_error()) { if (r_json_value.is_error()) {
return Status::Error(400, "Failed to parse payload as JSON object"); return Status::Error(400, "Failed to parse payload as JSON object");