mirror of
https://github.com/paricafe/misskey.git
synced 2025-02-17 14:47:29 -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
|
# VSCode addon
|
||||||
.favorites.json
|
.favorites.json
|
||||||
|
|
||||||
|
/dump.rdb
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkPullToRefresh :refresher="() => reload()">
|
<MkPullToRefresh :refresher="() => reload()">
|
||||||
<MkPagination ref="pagingComponent" :pagination="pagination">
|
<MkPagination ref="pagingComponent" :pagination="pagination" @queue="onQueue">
|
||||||
<template #empty>
|
<template #empty>
|
||||||
<div class="_fullinfo">
|
<div class="_fullinfo">
|
||||||
<img :src="infoImageUrl" class="_ghost"/>
|
<img :src="infoImageUrl" class="_ghost"/>
|
||||||
|
@ -24,7 +24,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<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 MkPagination from '@/components/MkPagination.vue';
|
||||||
import XNotification from '@/components/MkNotification.vue';
|
import XNotification from '@/components/MkNotification.vue';
|
||||||
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
|
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
|
||||||
|
@ -35,7 +36,12 @@ import { notificationTypes } from '@@/js/const.js';
|
||||||
import { infoImageUrl } from '@/instance.js';
|
import { infoImageUrl } from '@/instance.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
|
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<{
|
const props = defineProps<{
|
||||||
excludeTypes?: typeof notificationTypes[number][];
|
excludeTypes?: typeof notificationTypes[number][];
|
||||||
|
@ -65,9 +71,26 @@ function onNotification(notification) {
|
||||||
|
|
||||||
if (!isMuted) {
|
if (!isMuted) {
|
||||||
pagingComponent.value?.prepend(notification);
|
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() {
|
function reload() {
|
||||||
return new Promise<void>((res) => {
|
return new Promise<void>((res) => {
|
||||||
pagingComponent.value?.reload().then(() => {
|
pagingComponent.value?.reload().then(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue