mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-28 03:46:43 -06:00
fix conflixt
This commit is contained in:
parent
94df6b3d7d
commit
20408c2c46
2 changed files with 28 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -78,3 +78,5 @@ vite.config.ts.timestamp-*
|
|||
|
||||
# VSCode addon
|
||||
.favorites.json
|
||||
|
||||
/dump.rdb
|
||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<MkPullToRefresh :refresher="() => reload()">
|
||||
<MkPagination ref="pagingComponent" :pagination="pagination">
|
||||
<MkPagination ref="pagingComponent" :pagination="pagination" @queue="onQueue">
|
||||
<template #empty>
|
||||
<div class="_fullinfo">
|
||||
<img :src="infoImageUrl" class="_ghost"/>
|
||||
|
@ -24,7 +24,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onUnmounted, onDeactivated, onMounted, computed, shallowRef, onActivated } from 'vue';
|
||||
import { defineAsyncComponent, onUnmounted, onDeactivated, onMounted, computed, shallowRef, onActivated } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
import XNotification from '@/components/MkNotification.vue';
|
||||
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
|
||||
|
@ -35,7 +36,12 @@ import { notificationTypes } from '@@/js/const.js';
|
|||
import { infoImageUrl } from '@/instance.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api';
|
||||
|
||||
const MkNote = defineAsyncComponent(() =>
|
||||
(defaultStore.state.noteDesign === 'misskey') ? import('@/components/MkNote.vue') :
|
||||
null,
|
||||
);
|
||||
|
||||
const props = defineProps<{
|
||||
excludeTypes?: typeof notificationTypes[number][];
|
||||
|
@ -65,9 +71,26 @@ function onNotification(notification) {
|
|||
|
||||
if (!isMuted) {
|
||||
pagingComponent.value?.prepend(notification);
|
||||
onQueue();
|
||||
}
|
||||
}
|
||||
|
||||
let queued = false;
|
||||
|
||||
function checkAllNotificationsCanRead() {
|
||||
queued = false;
|
||||
if (!document.hasFocus()) { onQueue(); return; }
|
||||
if (!(pagingComponent.value?.queue.size) && !(props.excludeTypes?.length)) {
|
||||
misskeyApi('notifications/mark-all-as-read');
|
||||
}
|
||||
}
|
||||
|
||||
function onQueue() {
|
||||
if (queued) return;
|
||||
queued = true;
|
||||
setTimeout(() => checkAllNotificationsCanRead(), 2000);
|
||||
}
|
||||
|
||||
function reload() {
|
||||
return new Promise<void>((res) => {
|
||||
pagingComponent.value?.reload().then(() => {
|
||||
|
|
Loading…
Reference in a new issue