diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2023-09-11 14:31:50 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-11 14:31:50 +0900 |
| commit | cd6428715e6780d51e8f6edf93fe7e32bd8f937b (patch) | |
| tree | 3a1ac5a3f7d01f4fa1fbcb29af7c5bd9df0d6581 /packages/frontend/src/ui/_common_ | |
| parent | fix (diff) | |
| download | misskey-cd6428715e6780d51e8f6edf93fe7e32bd8f937b.tar.gz misskey-cd6428715e6780d51e8f6edf93fe7e32bd8f937b.tar.bz2 misskey-cd6428715e6780d51e8f6edf93fe7e32bd8f937b.zip | |
feat: テスト通知を送信できるようにする (#11810)
* (add) Notification test
* Update Changelog
* (add) backend, frontend impl
* globalEventの名前を明確にする
* Run API Extractor
Diffstat (limited to 'packages/frontend/src/ui/_common_')
| -rw-r--r-- | packages/frontend/src/ui/_common_/common.vue | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/packages/frontend/src/ui/_common_/common.vue b/packages/frontend/src/ui/_common_/common.vue index 61fcb0b171..65c5dbb384 100644 --- a/packages/frontend/src/ui/_common_/common.vue +++ b/packages/frontend/src/ui/_common_/common.vue @@ -56,6 +56,7 @@ import { $i } from '@/account'; import { useStream } from '@/stream'; import { i18n } from '@/i18n'; import { defaultStore } from '@/store'; +import { globalEvents } from '@/events'; const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue')); const XUpload = defineAsyncComponent(() => import('./upload.vue')); @@ -64,11 +65,13 @@ const dev = _DEV_; let notifications = $ref<Misskey.entities.Notification[]>([]); -function onNotification(notification) { +function onNotification(notification: Misskey.entities.Notification, isClient: boolean = false) { if ($i.mutingNotificationTypes.includes(notification.type)) return; if (document.visibilityState === 'visible') { - useStream().send('readNotification'); + if (!isClient) { + useStream().send('readNotification'); + } notifications.unshift(notification); window.setTimeout(() => { @@ -86,6 +89,7 @@ function onNotification(notification) { if ($i) { const connection = useStream().useChannel('main', null, 'UI'); connection.on('notification', onNotification); + globalEvents.on('clientNotification', notification => onNotification(notification, true)); //#region Listen message from SW if ('serviceWorker' in navigator) { |