diff options
| author | Kagami Sascha Rosylight <saschanaz@outlook.com> | 2022-12-12 19:27:47 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-12 19:27:47 +0900 |
| commit | 8211893210812fe02d3a798df05f0434a54dd973 (patch) | |
| tree | 239acddeca94f87668ab2829c3f8d6cd80a2c9ca /packages/sw/src/scripts/create-notification.ts | |
| parent | update deps (diff) | |
| download | misskey-8211893210812fe02d3a798df05f0434a54dd973.tar.gz misskey-8211893210812fe02d3a798df05f0434a54dd973.tar.bz2 misskey-8211893210812fe02d3a798df05f0434a54dd973.zip | |
Fix lint errors (except `@typescript-eslint/prefer-nullish-coalescing`) (#9311)
* `yarn workspace client run lint --fix`
* `eslint-disable-next-line no-var` for service worker self
* A few more manual sw fixes
* word change
Diffstat (limited to 'packages/sw/src/scripts/create-notification.ts')
| -rw-r--r-- | packages/sw/src/scripts/create-notification.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/packages/sw/src/scripts/create-notification.ts b/packages/sw/src/scripts/create-notification.ts index 7c95e8e41f..cbc86d1d7e 100644 --- a/packages/sw/src/scripts/create-notification.ts +++ b/packages/sw/src/scripts/create-notification.ts @@ -1,6 +1,9 @@ /* * Notification manager for SW */ + +// TODO: remove this declaration when https://github.com/microsoft/TypeScript/issues/11781 closes +// eslint-disable-next-line no-var declare var self: ServiceWorkerGlobalScope; import { swLang } from '@/scripts/lang'; @@ -40,7 +43,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data */ case 'notification': switch (data.body.type) { - case 'follow': + case 'follow': { // users/showの型定義をswos.apiへ当てはめるのが困難なのでapiFetch.requestを直接使用 const account = await getAccountFromId(data.userId); if (!account) return null; @@ -57,6 +60,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data } ], }]; + } case 'mention': return [t('_notification.youGotMention', { name: getUserName(data.body.user) }), { @@ -120,7 +124,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data ], }]; - case 'reaction': + case 'reaction': { let reaction = data.body.reaction; let badge: string | undefined; @@ -150,7 +154,6 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data badge = `/twemoji-badge/${char2fileName(reaction)}.png`; } - if (badge ? await fetch(badge).then(res => res.status !== 200).catch(() => true) : true) { badge = iconUrl('plus'); } @@ -167,6 +170,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data } ], }]; + } case 'pollVote': return [t('_notification.youGotPoll', { name: getUserName(data.body.user) }), { |