Only build notification when there are subscriptions

This commit is contained in:
Yannick Funk
2021-09-02 20:32:36 +02:00
parent b5aa0ee971
commit f6b55574b1

View File

@@ -301,8 +301,8 @@ impl Message {
}
let mentions = self.mentions.clone();
let enc = serde_json::to_string(&PushNotification::new(self.clone()).await).unwrap();
ClientboundNotification::Message(self).publish(channel.id().to_string());
ClientboundNotification::Message(self.clone()).publish(channel.id().to_string());
/*
Web Push Test Code
@@ -365,6 +365,7 @@ impl Message {
}
if subscriptions.len() > 0 {
let enc = serde_json::to_string(&PushNotification::new(self).await).unwrap();
let client = WebPushClient::new();
let key =
base64::decode_config(VAPID_PRIVATE_KEY.clone(), base64::URL_SAFE).unwrap();