feat(frontend/reactions): リアクションのミュートで通知からもミュートされるように (MisskeyIO#771)

This commit is contained in:
あわわわとーにゅ 2024-10-21 09:34:33 +09:00 committed by GitHub
parent ea6b9f40d2
commit e51b237c59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 2 deletions

View file

@ -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" :filter="filterMutedNotification">
<template #empty>
<div class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
@ -34,6 +34,7 @@ import { i18n } from '@/i18n.js';
import { notificationTypes } from '@/const.js';
import { infoImageUrl } from '@/instance.js';
import { defaultStore } from '@/store.js';
import { filterMutedNotification } from '@/scripts/filter-muted-notification.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import * as Misskey from 'misskey-js';
@ -63,7 +64,7 @@ function onNotification(notification) {
useStream().send('readNotification');
}
if (!isMuted) {
if (!isMuted && filterMutedNotification(notification)) {
pagingComponent.value?.prepend(notification);
}
}

View file

@ -84,6 +84,7 @@ const props = withDefaults(defineProps<{
pagination: Paging;
disableAutoLoad?: boolean;
displayLimit?: number;
filter?: (item: MisskeyEntity) => boolean;
}>(), {
displayLimit: 20,
});
@ -178,6 +179,8 @@ async function init(): Promise<void> {
limit: props.pagination.limit ?? 10,
allowPartial: true,
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
for (let i = 0; i < res.length; i++) {
const item = res[i];
if (i === 3) item._shouldInsertAd_ = true;
@ -219,6 +222,8 @@ const fetchMore = async (): Promise<void> => {
untilId: items.value[items.value.length - 1].id,
}),
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
for (let i = 0; i < res.length; i++) {
const item = res[i];
if (i === 10) item._shouldInsertAd_ = true;
@ -283,6 +288,8 @@ const fetchMoreAhead = async (): Promise<void> => {
sinceId: items.value[0].id,
}),
}).then(res => {
res = res.filter(item => !props.filter || props.filter(item));
if (res.length === 0) {
items.value = res.concat(items.value);
more.value = false;