diff options
| author | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2023-04-04 15:01:31 +0900 |
|---|---|---|
| committer | Acid Chicken (硫酸鶏) <root@acid-chicken.com> | 2023-04-04 15:01:31 +0900 |
| commit | 7e845ebbc2b148174205addb727a4d01b244f187 (patch) | |
| tree | e850aa53f1cd9d80e612a41fc88eaf4e51829e3a /packages/frontend/src/components | |
| parent | style: note about `TSSatisfiesExpression` (diff) | |
| parent | Merge branch 'develop' of https://github.com/misskey-dev/misskey into develop (diff) | |
| download | misskey-7e845ebbc2b148174205addb727a4d01b244f187.tar.gz misskey-7e845ebbc2b148174205addb727a4d01b244f187.tar.bz2 misskey-7e845ebbc2b148174205addb727a4d01b244f187.zip | |
Merge branch 'develop' of https://github.com/misskey-dev/misskey into storybook
Diffstat (limited to 'packages/frontend/src/components')
| -rw-r--r-- | packages/frontend/src/components/MkNotification.vue | 32 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkNotifications.vue | 35 | ||||
| -rw-r--r-- | packages/frontend/src/components/MkOmit.vue | 2 |
3 files changed, 4 insertions, 65 deletions
diff --git a/packages/frontend/src/components/MkNotification.vue b/packages/frontend/src/components/MkNotification.vue index b60967de02..efae687e66 100644 --- a/packages/frontend/src/components/MkNotification.vue +++ b/packages/frontend/src/components/MkNotification.vue @@ -83,7 +83,7 @@ </template> <script lang="ts" setup> -import { ref, shallowRef, onMounted, onUnmounted, watch } from 'vue'; +import { ref, shallowRef } from 'vue'; import * as misskey from 'misskey-js'; import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkFollowButton from '@/components/MkFollowButton.vue'; @@ -94,7 +94,6 @@ import { notePage } from '@/filters/note'; import { userPage } from '@/filters/user'; import { i18n } from '@/i18n'; import * as os from '@/os'; -import { stream } from '@/stream'; import { useTooltip } from '@/scripts/use-tooltip'; import { $i } from '@/account'; @@ -110,35 +109,6 @@ const props = withDefaults(defineProps<{ const elRef = shallowRef<HTMLElement>(null); const reactionRef = ref(null); -let readObserver: IntersectionObserver | undefined; -let connection; - -onMounted(() => { - if (!props.notification.isRead) { - readObserver = new IntersectionObserver((entries, observer) => { - if (!entries.some(entry => entry.isIntersecting)) return; - stream.send('readNotification', { - id: props.notification.id, - }); - observer.disconnect(); - }); - - readObserver.observe(elRef.value); - - connection = stream.useChannel('main'); - connection.on('readAllNotifications', () => readObserver.disconnect()); - - watch(props.notification.isRead, () => { - readObserver.disconnect(); - }); - } -}); - -onUnmounted(() => { - if (readObserver) readObserver.disconnect(); - if (connection) connection.dispose(); -}); - const followRequestDone = ref(false); const acceptFollowRequest = () => { diff --git a/packages/frontend/src/components/MkNotifications.vue b/packages/frontend/src/components/MkNotifications.vue index 874f1f90ea..1aea95fe0e 100644 --- a/packages/frontend/src/components/MkNotifications.vue +++ b/packages/frontend/src/components/MkNotifications.vue @@ -29,7 +29,6 @@ import { notificationTypes } from '@/const'; const props = defineProps<{ includeTypes?: typeof notificationTypes[number][]; - unreadOnly?: boolean; }>(); const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); @@ -40,23 +39,17 @@ const pagination: Paging = { params: computed(() => ({ includeTypes: props.includeTypes ?? undefined, excludeTypes: props.includeTypes ? undefined : $i.mutingNotificationTypes, - unreadOnly: props.unreadOnly, })), }; const onNotification = (notification) => { const isMuted = props.includeTypes ? !props.includeTypes.includes(notification.type) : $i.mutingNotificationTypes.includes(notification.type); if (isMuted || document.visibilityState === 'visible') { - stream.send('readNotification', { - id: notification.id, - }); + stream.send('readNotification'); } if (!isMuted) { - pagingComponent.value.prepend({ - ...notification, - isRead: document.visibilityState === 'visible', - }); + pagingComponent.value.prepend(notification); } }; @@ -65,30 +58,6 @@ let connection; onMounted(() => { connection = stream.useChannel('main'); connection.on('notification', onNotification); - connection.on('readAllNotifications', () => { - if (pagingComponent.value) { - for (const item of pagingComponent.value.queue) { - item.isRead = true; - } - for (const item of pagingComponent.value.items) { - item.isRead = true; - } - } - }); - connection.on('readNotifications', notificationIds => { - if (pagingComponent.value) { - for (let i = 0; i < pagingComponent.value.queue.length; i++) { - if (notificationIds.includes(pagingComponent.value.queue[i].id)) { - pagingComponent.value.queue[i].isRead = true; - } - } - for (let i = 0; i < (pagingComponent.value.items || []).length; i++) { - if (notificationIds.includes(pagingComponent.value.items[i].id)) { - pagingComponent.value.items[i].isRead = true; - } - } - } - }); }); onUnmounted(() => { diff --git a/packages/frontend/src/components/MkOmit.vue b/packages/frontend/src/components/MkOmit.vue index 9232ebb7c9..0f148022bf 100644 --- a/packages/frontend/src/components/MkOmit.vue +++ b/packages/frontend/src/components/MkOmit.vue @@ -12,7 +12,7 @@ import { onMounted } from 'vue'; import { i18n } from '@/i18n'; const props = withDefaults(defineProps<{ - maxHeight: number; + maxHeight?: number; }>(), { maxHeight: 200, }); |