summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/sw/unregister.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/server/api/endpoints/sw/unregister.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/server/api/endpoints/sw/unregister.ts')
-rw-r--r--packages/backend/src/server/api/endpoints/sw/unregister.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/backend/src/server/api/endpoints/sw/unregister.ts b/packages/backend/src/server/api/endpoints/sw/unregister.ts
index 5772eeee26..f12b98617d 100644
--- a/packages/backend/src/server/api/endpoints/sw/unregister.ts
+++ b/packages/backend/src/server/api/endpoints/sw/unregister.ts
@@ -6,7 +6,7 @@ import { DI } from '@/di-symbols.js';
export const meta = {
tags: ['account'],
- requireCredential: true,
+ requireCredential: false,
description: 'Unregister from receiving push notifications.',
} as const;
@@ -28,7 +28,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
) {
super(meta, paramDef, async (ps, me) => {
await this.swSubscriptionsRepository.delete({
- userId: me.id,
+ ...(me ? { userId: me.id } : {}),
endpoint: ps.endpoint,
});
});