1
0
Fork 0
mirror of https://github.com/paricafe/misskey.git synced 2025-03-01 15:24:26 -06:00

fix conflict

This commit is contained in:
Nya Candy 2024-01-25 17:19:58 +08:00 committed by fly_mc
parent e4fdd42555
commit 87ecfe55c8

View file

@ -13,9 +13,9 @@ SPDX-License-Identifier: AGPL-3.0-only
:tabindex="isDeleted ? '-1' : '0'"
>
<div v-if="appearNote.reply && appearNote.reply.replyId">
<div v-if="!conversationLoaded" style="padding: 16px">
<!-- <div v-if="!conversationLoaded" style="padding: 16px">
<MkButton style="margin: 0 auto;" primary rounded @click="loadConversation">{{ i18n.ts.loadConversation }}</MkButton>
</div>
</div> -->
<MkNoteSub v-for="note in conversation" :key="note.id" :class="$style.replyToMore" :note="note"/>
</div>
<MkNoteSub v-if="appearNote.reply" :note="appearNote.reply" :class="$style.replyTo"/>
@ -102,6 +102,19 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
</div>
<MkA v-if="appearNote.channel && !inChannel" :class="$style.channel" :to="`/channels/${appearNote.channel.id}`"><i class="ti ti-device-tv"></i> {{ appearNote.channel.name }}</MkA>
<div v-if="showingNoteHistoryRef" :class="$style.translation">
<b><MkTime :time="showingNoteHistoryRef.createdAt"/>: </b>
<div v-if="showingNoteHistoryRef.cw">
<p :class="$style.cw">
<Mfm style="margin-right: 8px;" :text="showingNoteHistoryRef.cw" :author="appearNote.user" :nyaize="'respect'"/>
</p>
<hr/>
</div>
<div v-if="showingNoteHistoryRef.text">
<Mfm :text="showingNoteHistoryRef.text" :author="appearNote.user" :nyaize="'respect'" :emojiUrls="appearNote.emojis"/>
</div>
</div>
</div>
<footer>
<div :class="$style.noteFooterInfo">
@ -137,6 +150,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<i v-else class="ti ti-plus"></i>
<p v-if="(appearNote.reactionAcceptance === 'likeOnly' || defaultStore.state.showReactionsCount) && appearNote.reactionCount > 0" :class="$style.noteFooterButtonCount">{{ number(appearNote.reactionCount) }}</p>
</button>
<button
v-if="appearNote.updatedAt" ref="historyMenuButton" class="_button" :class="[
$style.noteFooterButton,
$style.noteFooterButtonHistoryMenu,
showingNoteHistoryRef ? $style.active : undefined,
]" @mousedown="historyMenu()"
>
<i class="ti ti-history"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" class="_button" :class="$style.noteFooterButton" @mousedown.prevent="clip()">
<i class="ti ti-paperclip"></i>
</button>
@ -152,9 +174,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div>
<div v-if="tab === 'replies'">
<div v-if="!repliesLoaded" style="padding: 16px">
<!-- <div v-if="!repliesLoaded" style="padding: 16px">
<MkButton style="margin: 0 auto;" primary rounded @click="loadReplies">{{ i18n.ts.loadReplies }}</MkButton>
</div>
</div> -->
<MkNoteSub v-for="note in replies" :key="note.id" :note="note" :class="$style.reply" :detail="true"/>
</div>
<div v-else-if="tab === 'renotes'" :class="$style.tab_renotes">
@ -279,6 +301,7 @@ const renoteButton = shallowRef<HTMLElement>();
const renoteTime = shallowRef<HTMLElement>();
const reactButton = shallowRef<HTMLElement>();
const clipButton = shallowRef<HTMLElement>();
const historyMenuButton = shallowRef<HTMLElement>();
const appearNote = computed(() => getAppearNote(note.value));
const galleryEl = shallowRef<InstanceType<typeof MkMediaList>>();
const isMyRenote = $i && ($i.id === note.value.userId);
@ -287,13 +310,20 @@ const isDeleted = ref(false);
const muted = ref($i ? checkWordMute(appearNote.value, $i, $i.mutedWords) : false);
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null;
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
const urls = computed(() => parsed.value ? extractUrlFromMfm(parsed.value).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const conversation = ref<Misskey.entities.Note[]>([]);
const replies = ref<Misskey.entities.Note[]>([]);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
type ShowingNoteHistoryState = {
createdAt: string | null;
text: string | null;
cw?: string | null;
} | null;
const showingNoteHistoryRef = ref<ShowingNoteHistoryState>(null);
const pleaseLoginContext = computed<OpenOnRemoteOptions>(() => ({
type: 'lookup',
url: `https://${host}/notes/${appearNote.value.id}`,
@ -496,6 +526,41 @@ function showMenu(): void {
os.popupMenu(menu, menuButton.value).then(focus).finally(cleanup);
}
const setCurrentNoteInfo = (state: ShowingNoteHistoryState) => {
// Set current showing
showingNoteHistoryRef.value = state;
};
const fullHistoryWithLatest = computed(() =>
appearNote.value.updatedAt ? [{
createdAt: appearNote.value.updatedAt,
text: appearNote.value.text,
cw: appearNote.value.cw,
displayText: i18n.ts.latestVersion,
clearState: true,
}, ...appearNote.value.history
.map(h => ({
...h,
displayText: null,
clearState: false,
})),
] : [],
);
function historyMenu(viaKeyboard = false): void {
const currentNoteUpdatedAtDate = new Date(showingNoteHistoryRef.value?.createdAt || appearNote.value.updatedAt).getTime();
const menu = fullHistoryWithLatest.value
.sort((h1, h2) => new Date(h2.createdAt).getTime() - new Date(h1.createdAt).getTime())
.map(h => ({
active: new Date(h.createdAt).getTime() === currentNoteUpdatedAtDate,
text: h.displayText || new Date(h.createdAt).toISOString(),
action: () => setCurrentNoteInfo(h.clearState ? null : h),
}));
os.popupMenu(menu, historyMenuButton.value, {
viaKeyboard,
}).then(focus);
}
async function clip(): Promise<void> {
os.popupMenu(await getNoteClipMenu({ note: note.value, isDeleted }), clipButton.value).then(focus);
}
@ -524,10 +589,10 @@ function blur() {
rootEl.value?.blur();
}
const repliesLoaded = ref(false);
// const repliesLoaded = ref(false);
function loadReplies() {
repliesLoaded.value = true;
// repliesLoaded.value = true;
misskeyApi('notes/children', {
noteId: appearNote.value.id,
limit: 30,
@ -536,10 +601,10 @@ function loadReplies() {
});
}
const conversationLoaded = ref(false);
// const conversationLoaded = ref(false);
function loadConversation() {
conversationLoaded.value = true;
// conversationLoaded.value = true;
if (appearNote.value.replyId == null) return;
misskeyApi('notes/conversation', {
noteId: appearNote.value.replyId,
@ -547,6 +612,12 @@ function loadConversation() {
conversation.value = res.reverse();
});
}
// Extend note content automatically (no manual click)
onMounted(() => {
loadReplies();
loadConversation();
});
</script>
<style lang="scss" module>
@ -769,6 +840,12 @@ function loadConversation() {
}
}
.noteFooterButtonHistoryMenu {
&.active {
color: var(--accent);
}
}
.reply:not(:first-child) {
border-top: solid 0.5px var(--divider);
}