summaryrefslogtreecommitdiff
path: root/packages/frontend/src/components/SkFollowingRecentNotes.vue
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-10 21:21:50 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-12 21:46:03 -0400
commit5cb0129c499e7bbf7fd34b34cdd4b51cc8086184 (patch)
treebad3f112212ff7a45db520b60558d397c7b772c1 /packages/frontend/src/components/SkFollowingRecentNotes.vue
parentshow muted words in NoteDetailed / NoteSub components (diff)
downloadsharkey-5cb0129c499e7bbf7fd34b34cdd4b51cc8086184.tar.gz
sharkey-5cb0129c499e7bbf7fd34b34cdd4b51cc8086184.tar.bz2
sharkey-5cb0129c499e7bbf7fd34b34cdd4b51cc8086184.zip
show muted words in following feed
Diffstat (limited to 'packages/frontend/src/components/SkFollowingRecentNotes.vue')
-rw-r--r--packages/frontend/src/components/SkFollowingRecentNotes.vue39
1 files changed, 3 insertions, 36 deletions
diff --git a/packages/frontend/src/components/SkFollowingRecentNotes.vue b/packages/frontend/src/components/SkFollowingRecentNotes.vue
index bc8560bbb0..b8a7b2213f 100644
--- a/packages/frontend/src/components/SkFollowingRecentNotes.vue
+++ b/packages/frontend/src/components/SkFollowingRecentNotes.vue
@@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #default="{ items: notes }">
<MkDateSeparatedList v-slot="{ item: note }" :items="notes" :class="$style.panel" :noGap="true">
- <SkFollowingFeedEntry v-if="!isHardMuted(note)" :isMuted="isSoftMuted(note)" :note="note" :class="props.selectedUserId == note.userId && $style.selected" @select="u => selectUser(u.id)"/>
+ <SkFollowingFeedEntry v-if="!getHardMutedWords(note)" :note="note" :class="props.selectedUserId == note.userId && $style.selected" @select="u => selectUser(u.id)"/>
</MkDateSeparatedList>
</template>
</MkPagination>
@@ -23,17 +23,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
-import * as Misskey from 'misskey-js';
import { computed, shallowRef } from 'vue';
-import type { FollowingFeedTab } from '@/types/following-feed.js';
import type { Paging } from '@/components/MkPagination.vue';
+import type { FollowingFeedTab } from '@/types/following-feed.js';
+import { getHardMutedWords } from '@/utility/following-feed-utils.js';
import { infoImageUrl } from '@/instance.js';
import { i18n } from '@/i18n.js';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import MkPagination from '@/components/MkPagination.vue';
import SkFollowingFeedEntry from '@/components/SkFollowingFeedEntry.vue';
-import { $i } from '@/i.js';
-import { checkWordMute } from '@/utility/check-word-mute.js';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
const props = defineProps<{
@@ -84,37 +82,6 @@ const latestNotesPagination: Paging<'notes/following'> = {
};
const latestNotesPaging = shallowRef<InstanceType<typeof MkPagination>>();
-
-function isSoftMuted(note: Misskey.entities.Note): boolean {
- return isMuted(note, $i?.mutedWords);
-}
-
-function isHardMuted(note: Misskey.entities.Note): boolean {
- return isMuted(note, $i?.hardMutedWords);
-}
-
-// Match the typing used by Misskey
-type Mutes = (string | string[])[] | null | undefined;
-
-// Adapted from MkNote.ts
-function isMuted(note: Misskey.entities.Note, mutes: Mutes): boolean {
- return checkMute(note, mutes)
- || checkMute(note.reply, mutes)
- || checkMute(note.renote, mutes);
-}
-
-// Adapted from check-word-mute.ts
-function checkMute(note: Misskey.entities.Note | undefined | null, mutes: Mutes): boolean {
- if (!note) {
- return false;
- }
-
- if (!mutes || mutes.length < 1) {
- return false;
- }
-
- return !!checkWordMute(note, $i, mutes);
-}
</script>
<style module lang="scss">