fix(cdn-caching): 自分のリアクションが表示されない問題を修正 (MisskeyIO#851)

This commit is contained in:
あわわわとーにゅ 2024-12-25 14:13:45 +09:00 committed by GitHub
parent 5073467f1d
commit 8b17ab77b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 103 additions and 71 deletions

View file

@ -18,12 +18,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, onUnmounted, provide, shallowRef } from 'vue';
import { time as gtagTime } from 'vue-gtag';
import * as Misskey from 'misskey-js';
import MkNotes from '@/components/MkNotes.vue';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { useStream } from '@/stream.js';
import * as sound from '@/scripts/sound.js';
import { deepMerge } from '@/scripts/merge.js';
import { $i, iAmModerator } from '@/account.js';
import { instance } from '@/instance.js';
import { defaultStore } from '@/store.js';
@ -76,7 +76,7 @@ async function prepend(data) {
let note = data;
//
// idOnlyid
// minimizeid
if (!data.visibility) {
const res = await window.fetch(`/notes/${data.id}.json`, {
method: 'GET',
@ -87,7 +87,7 @@ async function prepend(data) {
},
});
if (!res.ok) return;
note = await res.json();
note = deepMerge(data, await res.json());
}
tlNotesCount++;
@ -108,7 +108,7 @@ async function prepend(data) {
let connection: Misskey.ChannelConnection | null = null;
let connection2: Misskey.ChannelConnection | null = null;
let paginationQuery: Paging | null = null;
const idOnly = !iAmModerator;
const minimize = !iAmModerator;
const stream = useStream();
@ -117,13 +117,13 @@ function connectChannel() {
if (props.antenna == null) return;
connection = stream.useChannel('antenna', {
antennaId: props.antenna,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'home') {
connection = stream.useChannel('homeTimeline', {
withRenotes: props.withRenotes,
withFiles: props.onlyFiles ? true : undefined,
idOnly: idOnly,
minimize: minimize,
});
connection2 = stream.useChannel('main');
} else if (props.src === 'local') {
@ -131,27 +131,27 @@ function connectChannel() {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withFiles: props.onlyFiles ? true : undefined,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'media') {
connection = stream.useChannel('hybridTimeline', {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withFiles: true,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'social') {
connection = stream.useChannel('hybridTimeline', {
withRenotes: props.withRenotes,
withReplies: props.withReplies,
withFiles: props.onlyFiles ? true : undefined,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'global') {
connection = stream.useChannel('globalTimeline', {
withRenotes: props.withRenotes,
withFiles: props.onlyFiles ? true : undefined,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'mentions') {
connection = stream.useChannel('main');
@ -170,19 +170,19 @@ function connectChannel() {
withRenotes: props.withRenotes,
withFiles: props.onlyFiles ? true : undefined,
listId: props.list,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'channel') {
if (props.channel == null) return;
connection = stream.useChannel('channel', {
channelId: props.channel,
idOnly: idOnly,
minimize: minimize,
});
} else if (props.src === 'role') {
if (props.role == null) return;
connection = stream.useChannel('roleTimeline', {
roleId: props.role,
idOnly: idOnly,
minimize: minimize,
});
}
if (props.src !== 'directs' && props.src !== 'mentions') connection?.on('note', prepend);