Skip to content

Commit 102b894

Browse files
committed
Immediate: users should be able to disable push notifications
1 parent 20cb3c2 commit 102b894

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

server-src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2933,7 +2933,7 @@ const server = http.createServer(async function (req, res) {
29332933
return;
29342934
}
29352935

2936-
if (typeof json.endpoint == "string") {
2936+
if (typeof json.endpoint !== "string") {
29372937
res.statusCode = 401;
29382938
res.end("Endpoint is invalid type.");
29392939
return;

src/accounthelper/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ async function uploadPushSubscription(subscription) {
169169
async function uploadRemovePushSubscription(subscription) {
170170
var response = await fetch(getServerURL() + "/webpush/unsubscribe", {
171171
method: "POST",
172-
body: JSON.stringify(subscription),
172+
body: JSON.stringify({
173+
endpoint: subscription.endpoint
174+
}),
173175
headers: { "Content-Type": "application/json" },
174176
});
175177
if (!response.ok) {
@@ -195,8 +197,8 @@ pushNotificationHelper.unsubscribe = async function () {
195197
if (!subscription) {
196198
return; //No subscription
197199
}
198-
await pushNotificationHelper.__unsubscribe();
199200
await uploadRemovePushSubscription(subscription);
201+
await pushNotificationHelper.__unsubscribe();
200202
};
201203

202204
module.exports = {

src/chat/interface/notifications/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class RealTimeNotifications {
214214
event: "click",
215215
func: function () {
216216
_this.dialogElement.hidden = false;
217+
_this.loadNotifications();
217218
},
218219
},
219220
],

wpstatic/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":"1770739203980"}
1+
{"timestamp":"1770740200809"}

0 commit comments

Comments
 (0)