summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/PushNotificationService.ts
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2022-12-18 01:59:59 +0900
committerGitHub <noreply@github.com>2022-12-18 01:59:59 +0900
commit4ecc42744c3c8b68e38f58bfe03919bf437f137a (patch)
tree094230a6992c05cf39136913d02400fae27931d7 /packages/backend/src/core/PushNotificationService.ts
parentfix(server): GitHubログインしようとするとreply.setCookie is not a ... (diff)
downloadsharkey-4ecc42744c3c8b68e38f58bfe03919bf437f137a.tar.gz
sharkey-4ecc42744c3c8b68e38f58bfe03919bf437f137a.tar.bz2
sharkey-4ecc42744c3c8b68e38f58bfe03919bf437f137a.zip
enhance: Implement the toggle to (or not to) close push notifications when notifications or messages are read (#9219)
* create file * wip * fix * wip * tabun dekita * :v: * implement subscribe push notification button to tutorial * check-exists→show-registration * add column sendReadMessage * fix migration file * sw api * change PushNotificationService * wip * :v: * fix tutorial footer flex
Diffstat (limited to 'packages/backend/src/core/PushNotificationService.ts')
-rw-r--r--packages/backend/src/core/PushNotificationService.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/backend/src/core/PushNotificationService.ts b/packages/backend/src/core/PushNotificationService.ts
index df5284de4b..842cd1a9f8 100644
--- a/packages/backend/src/core/PushNotificationService.ts
+++ b/packages/backend/src/core/PushNotificationService.ts
@@ -69,6 +69,14 @@ export class PushNotificationService {
});
for (const subscription of subscriptions) {
+ // Continue if sendReadMessage is false
+ if ([
+ 'readNotifications',
+ 'readAllNotifications',
+ 'readAllMessagingMessages',
+ 'readAllMessagingMessagesOfARoom',
+ ].includes(type) && !subscription.sendReadMessage) continue;
+
const pushSubscription = {
endpoint: subscription.endpoint,
keys: {