summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/PushNotificationService.ts
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2023-02-25 20:04:48 +0100
committerGitHub <noreply@github.com>2023-02-25 20:04:48 +0100
commitb468330ed944cd2aefb93183786855e990bd3df3 (patch)
treeaae515a3d90bc6646854ea718c054540b2b654e9 /packages/backend/src/core/PushNotificationService.ts
parentAdd test (diff)
parentrefactor(frontend): fix eslint error (#10084) (diff)
downloadmisskey-b468330ed944cd2aefb93183786855e990bd3df3.tar.gz
misskey-b468330ed944cd2aefb93183786855e990bd3df3.tar.bz2
misskey-b468330ed944cd2aefb93183786855e990bd3df3.zip
Merge branch 'develop' into mkusername-empty
Diffstat (limited to 'packages/backend/src/core/PushNotificationService.ts')
-rw-r--r--packages/backend/src/core/PushNotificationService.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/backend/src/core/PushNotificationService.ts b/packages/backend/src/core/PushNotificationService.ts
index 75bf4b0e01..2cad1bc07e 100644
--- a/packages/backend/src/core/PushNotificationService.ts
+++ b/packages/backend/src/core/PushNotificationService.ts
@@ -9,7 +9,7 @@ import { MetaService } from '@/core/MetaService.js';
import { bindThis } from '@/decorators.js';
// Defined also packages/sw/types.ts#L13
-type pushNotificationsTypes = {
+type PushNotificationsTypes = {
'notification': Packed<'Notification'>;
'unreadAntennaNote': {
antenna: { id: string, name: string };
@@ -22,8 +22,8 @@ type pushNotificationsTypes = {
};
// Reduce length because push message servers have character limits
-function truncateBody<T extends keyof pushNotificationsTypes>(type: T, body: pushNotificationsTypes[T]): pushNotificationsTypes[T] {
- if (body === undefined) return body;
+function truncateBody<T extends keyof PushNotificationsTypes>(type: T, body: PushNotificationsTypes[T]): PushNotificationsTypes[T] {
+ if (typeof body !== 'object') return body;
return {
...body,
@@ -56,7 +56,7 @@ export class PushNotificationService {
}
@bindThis
- public async pushNotification<T extends keyof pushNotificationsTypes>(userId: string, type: T, body: pushNotificationsTypes[T]) {
+ public async pushNotification<T extends keyof PushNotificationsTypes>(userId: string, type: T, body: PushNotificationsTypes[T]) {
const meta = await this.metaService.fetch();
if (!meta.enableServiceWorker || meta.swPublicKey == null || meta.swPrivateKey == null) return;