mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-28 21:08:52 -07:00
revert 18156487d91bb2c7d4ba5588da37ab1f1e84350e
revert fix: move isRenote check to note.vue
This commit is contained in:
parent
306f629ca5
commit
27307a8de2
2 changed files with 57 additions and 53 deletions
|
@ -17,10 +17,10 @@
|
||||||
:note="note"
|
:note="note"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
/>
|
/>
|
||||||
<MkLoading v-else-if="note.reply" mini />
|
<MkLoading v-else-if="appearNote.reply" mini />
|
||||||
<MkNoteSub
|
<MkNoteSub
|
||||||
v-if="note.reply"
|
v-if="appearNote.reply"
|
||||||
:note="note.reply"
|
:note="appearNote.reply"
|
||||||
class="reply-to"
|
class="reply-to"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
/>
|
/>
|
||||||
|
@ -29,21 +29,21 @@
|
||||||
ref="noteEl"
|
ref="noteEl"
|
||||||
@contextmenu.stop="onContextmenu"
|
@contextmenu.stop="onContextmenu"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
:note="note"
|
:note="appearNote"
|
||||||
detailedView
|
detailedView
|
||||||
></MkNote>
|
></MkNote>
|
||||||
|
|
||||||
<MkTab v-model="tab" :style="'underline'" @update:modelValue="loadTab">
|
<MkTab v-model="tab" :style="'underline'" @update:modelValue="loadTab">
|
||||||
<option value="replies">
|
<option value="replies">
|
||||||
<!-- <i class="ph-arrow-u-up-left ph-bold ph-lg"></i> -->
|
<!-- <i class="ph-arrow-u-up-left ph-bold ph-lg"></i> -->
|
||||||
<span v-if="note.repliesCount > 0" class="count">{{
|
<span v-if="appearNote.repliesCount > 0" class="count">{{
|
||||||
note.repliesCount
|
appearNote.repliesCount
|
||||||
}}</span>
|
}}</span>
|
||||||
{{ i18n.ts._notification._types.reply }}
|
{{ i18n.ts._notification._types.reply }}
|
||||||
</option>
|
</option>
|
||||||
<option value="renotes" v-if="note.renoteCount > 0">
|
<option value="renotes" v-if="appearNote.renoteCount > 0">
|
||||||
<!-- <i class="ph-repeat ph-bold ph-lg"></i> -->
|
<!-- <i class="ph-repeat ph-bold ph-lg"></i> -->
|
||||||
<span class="count">{{ note.renoteCount }}</span>
|
<span class="count">{{ appearNote.renoteCount }}</span>
|
||||||
{{ i18n.ts._notification._types.renote }}
|
{{ i18n.ts._notification._types.renote }}
|
||||||
</option>
|
</option>
|
||||||
<option value="reactions" v-if="reactionsCount > 0">
|
<option value="reactions" v-if="reactionsCount > 0">
|
||||||
|
@ -71,10 +71,10 @@
|
||||||
class="reply"
|
class="reply"
|
||||||
:conversation="replies"
|
:conversation="replies"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
:parentId="note.id"
|
:parentId="appearNote.id"
|
||||||
/>
|
/>
|
||||||
<MkLoading
|
<MkLoading
|
||||||
v-else-if="tab === 'replies' && note.repliesCount > 0"
|
v-else-if="tab === 'replies' && appearNote.repliesCount > 0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MkNoteSub
|
<MkNoteSub
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
class="reply"
|
class="reply"
|
||||||
:conversation="replies"
|
:conversation="replies"
|
||||||
:detailedView="true"
|
:detailedView="true"
|
||||||
:parentId="note.id"
|
:parentId="appearNote.id"
|
||||||
/>
|
/>
|
||||||
<MkLoading v-else-if="tab === 'quotes' && directQuotes.length > 0" />
|
<MkLoading v-else-if="tab === 'quotes' && directQuotes.length > 0" />
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
/>
|
/>
|
||||||
<!-- </MkPagination> -->
|
<!-- </MkPagination> -->
|
||||||
<MkLoading
|
<MkLoading
|
||||||
v-else-if="tab === 'renotes' && note.renoteCount > 0"
|
v-else-if="tab === 'renotes' && appearNote.renoteCount > 0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div v-if="tab === 'clips' && clips.length > 0" class="_content clips">
|
<div v-if="tab === 'clips' && clips.length > 0" class="_content clips">
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
<MkReactedUsers
|
<MkReactedUsers
|
||||||
v-if="tab === 'reactions' && reactionsCount > 0"
|
v-if="tab === 'reactions' && reactionsCount > 0"
|
||||||
:note-id="note.id"
|
:note-id="appearNote.id"
|
||||||
></MkReactedUsers>
|
></MkReactedUsers>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="_panel muted" @click="muted.muted = false">
|
<div v-else class="_panel muted" @click="muted.muted = false">
|
||||||
|
@ -217,11 +217,23 @@ if (noteViewInterruptors.length > 0) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isRenote =
|
||||||
|
note.renote != null &&
|
||||||
|
note.text == null &&
|
||||||
|
note.fileIds.length === 0 &&
|
||||||
|
note.poll == null;
|
||||||
|
|
||||||
const el = ref<HTMLElement>();
|
const el = ref<HTMLElement>();
|
||||||
const noteEl = $ref();
|
const noteEl = $ref();
|
||||||
const menuButton = ref<HTMLElement>();
|
const menuButton = ref<HTMLElement>();
|
||||||
|
const starButton = ref<InstanceType<typeof XStarButton>>();
|
||||||
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
|
||||||
|
const renoteTime = ref<HTMLElement>();
|
||||||
const reactButton = ref<HTMLElement>();
|
const reactButton = ref<HTMLElement>();
|
||||||
|
let appearNote = $computed(() =>
|
||||||
|
isRenote ? (note.renote as misskey.entities.Note) : note
|
||||||
|
);
|
||||||
|
const isMyRenote = $i && $i.id === note.userId;
|
||||||
const showContent = ref(false);
|
const showContent = ref(false);
|
||||||
const isDeleted = ref(false);
|
const isDeleted = ref(false);
|
||||||
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
const muted = ref(getWordSoftMute(note, $i, defaultStore.state.mutedWords));
|
||||||
|
@ -251,14 +263,14 @@ const keymap = {
|
||||||
|
|
||||||
useNoteCapture({
|
useNoteCapture({
|
||||||
rootEl: el,
|
rootEl: el,
|
||||||
note: $$(note),
|
note: $$(appearNote),
|
||||||
isDeletedRef: isDeleted,
|
isDeletedRef: isDeleted,
|
||||||
});
|
});
|
||||||
|
|
||||||
function reply(viaKeyboard = false): void {
|
function reply(viaKeyboard = false): void {
|
||||||
pleaseLogin();
|
pleaseLogin();
|
||||||
os.post({
|
os.post({
|
||||||
reply: note,
|
reply: appearNote,
|
||||||
animation: !viaKeyboard,
|
animation: !viaKeyboard,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
focus();
|
focus();
|
||||||
|
@ -272,7 +284,7 @@ function react(viaKeyboard = false): void {
|
||||||
reactButton.value,
|
reactButton.value,
|
||||||
(reaction) => {
|
(reaction) => {
|
||||||
os.api("notes/reactions/create", {
|
os.api("notes/reactions/create", {
|
||||||
noteId: note.id,
|
noteId: appearNote.id,
|
||||||
reaction: reaction,
|
reaction: reaction,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -343,27 +355,27 @@ function blur() {
|
||||||
|
|
||||||
directReplies = null;
|
directReplies = null;
|
||||||
os.api("notes/children", {
|
os.api("notes/children", {
|
||||||
noteId: note.id,
|
noteId: appearNote.id,
|
||||||
limit: 30,
|
limit: 30,
|
||||||
depth: 12,
|
depth: 12,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
res = res.reduce((acc, note) => {
|
res = res.reduce((acc, note) => {
|
||||||
if (note.userId == note.userId) {
|
if (note.userId == appearNote.userId) {
|
||||||
return [...acc, note];
|
return [...acc, note];
|
||||||
}
|
}
|
||||||
return [note, ...acc];
|
return [note, ...acc];
|
||||||
}, []);
|
}, []);
|
||||||
replies.value = res;
|
replies.value = res;
|
||||||
directReplies = res
|
directReplies = res
|
||||||
.filter((note) => note.replyId === note.id)
|
.filter((note) => note.replyId === appearNote.id)
|
||||||
.reverse();
|
.reverse();
|
||||||
directQuotes = res.filter((note) => note.renoteId === note.id);
|
directQuotes = res.filter((note) => note.renoteId === appearNote.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
conversation = null;
|
conversation = null;
|
||||||
if (note.replyId) {
|
if (appearNote.replyId) {
|
||||||
os.api("notes/conversation", {
|
os.api("notes/conversation", {
|
||||||
noteId: note.replyId,
|
noteId: appearNote.replyId,
|
||||||
limit: 30,
|
limit: 30,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
conversation = res.reverse();
|
conversation = res.reverse();
|
||||||
|
@ -373,14 +385,14 @@ if (note.replyId) {
|
||||||
|
|
||||||
clips = null;
|
clips = null;
|
||||||
os.api("notes/clips", {
|
os.api("notes/clips", {
|
||||||
noteId: note.id,
|
noteId: appearNote.id,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
clips = res;
|
clips = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
// const pagination = {
|
// const pagination = {
|
||||||
// endpoint: "notes/renotes",
|
// endpoint: "notes/renotes",
|
||||||
// noteId: note.id,
|
// noteId: appearNote.id,
|
||||||
// limit: 10,
|
// limit: 10,
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
@ -390,7 +402,7 @@ renotes = null;
|
||||||
function loadTab() {
|
function loadTab() {
|
||||||
if (tab === "renotes" && !renotes) {
|
if (tab === "renotes" && !renotes) {
|
||||||
os.api("notes/renotes", {
|
os.api("notes/renotes", {
|
||||||
noteId: note.id,
|
noteId: appearNote.id,
|
||||||
limit: 100,
|
limit: 100,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
renotes = res;
|
renotes = res;
|
||||||
|
@ -402,7 +414,7 @@ async function onNoteUpdated(noteData: NoteUpdatedEvent): Promise<void> {
|
||||||
const { type, id, body } = noteData;
|
const { type, id, body } = noteData;
|
||||||
|
|
||||||
let found = -1;
|
let found = -1;
|
||||||
if (id === note.id) {
|
if (id === appearNote.id) {
|
||||||
found = 0;
|
found = 0;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < replies.value.length; i++) {
|
for (let i = 0; i < replies.value.length; i++) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:name="$store.state.animation ? 'fade' : ''"
|
:name="$store.state.animation ? 'fade' : ''"
|
||||||
mode="out-in"
|
mode="out-in"
|
||||||
>
|
>
|
||||||
<div v-if="appearNote" class="note">
|
<div v-if="note" class="note">
|
||||||
<div v-if="showNext" class="_gap">
|
<div v-if="showNext" class="_gap">
|
||||||
<XNotes
|
<XNotes
|
||||||
class="_content"
|
class="_content"
|
||||||
|
@ -33,12 +33,12 @@
|
||||||
</MkButton>
|
</MkButton>
|
||||||
<div class="note _gap">
|
<div class="note _gap">
|
||||||
<MkRemoteCaution
|
<MkRemoteCaution
|
||||||
v-if="appearNote.user.host != null"
|
v-if="note.user.host != null"
|
||||||
:href="appearNote.url ?? appearNote.uri"
|
:href="note.url ?? note.uri"
|
||||||
/>
|
/>
|
||||||
<XNoteDetailed
|
<XNoteDetailed
|
||||||
:key="appearNote.id"
|
:key="note.id"
|
||||||
v-model:note="appearNote"
|
v-model:note="note"
|
||||||
class="note"
|
class="note"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,6 +71,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent, watch } from "vue";
|
import { computed, defineComponent, watch } from "vue";
|
||||||
import * as misskey from "calckey-js";
|
import * as misskey from "calckey-js";
|
||||||
|
import XNote from "@/components/MkNote.vue";
|
||||||
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
import XNoteDetailed from "@/components/MkNoteDetailed.vue";
|
||||||
import XNotes from "@/components/MkNotes.vue";
|
import XNotes from "@/components/MkNotes.vue";
|
||||||
import MkRemoteCaution from "@/components/MkRemoteCaution.vue";
|
import MkRemoteCaution from "@/components/MkRemoteCaution.vue";
|
||||||
|
@ -89,17 +90,15 @@ let hasNext = $ref(false);
|
||||||
let showPrev = $ref(false);
|
let showPrev = $ref(false);
|
||||||
let showNext = $ref(false);
|
let showNext = $ref(false);
|
||||||
let error = $ref();
|
let error = $ref();
|
||||||
let isRenote = $ref(false);
|
|
||||||
let appearNote = $ref<null | misskey.entities.Note>();
|
|
||||||
|
|
||||||
const prevPagination = {
|
const prevPagination = {
|
||||||
endpoint: "users/notes" as const,
|
endpoint: "users/notes" as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() =>
|
params: computed(() =>
|
||||||
appearNote
|
note
|
||||||
? {
|
? {
|
||||||
userId: appearNote.userId,
|
userId: note.userId,
|
||||||
untilId: appearNote.id,
|
untilId: note.id,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
),
|
),
|
||||||
|
@ -110,10 +109,10 @@ const nextPagination = {
|
||||||
endpoint: "users/notes" as const,
|
endpoint: "users/notes" as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: computed(() =>
|
params: computed(() =>
|
||||||
appearNote
|
note
|
||||||
? {
|
? {
|
||||||
userId: appearNote.userId,
|
userId: note.userId,
|
||||||
sinceId: appearNote.id,
|
sinceId: note.id,
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
),
|
),
|
||||||
|
@ -130,13 +129,6 @@ function fetchNote() {
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
note = res;
|
note = res;
|
||||||
isRenote =
|
|
||||||
note.renote != null &&
|
|
||||||
note.text == null &&
|
|
||||||
note.fileIds.length === 0 &&
|
|
||||||
note.poll == null;
|
|
||||||
appearNote = isRenote ? (note.renote as misskey.entities.Note) : note;
|
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
os.api("users/notes", {
|
os.api("users/notes", {
|
||||||
userId: note.userId,
|
userId: note.userId,
|
||||||
|
@ -168,19 +160,19 @@ const headerTabs = $computed(() => []);
|
||||||
|
|
||||||
definePageMetadata(
|
definePageMetadata(
|
||||||
computed(() =>
|
computed(() =>
|
||||||
appearNote
|
note
|
||||||
? {
|
? {
|
||||||
title: i18n.t("noteOf", {
|
title: i18n.t("noteOf", {
|
||||||
user: appearNote.user.name || appearNote.user.username,
|
user: note.user.name || note.user.username,
|
||||||
}),
|
}),
|
||||||
subtitle: new Date(appearNote.createdAt).toLocaleString(),
|
subtitle: new Date(note.createdAt).toLocaleString(),
|
||||||
avatar: appearNote.user,
|
avatar: note.user,
|
||||||
path: `/notes/${appearNote.id}`,
|
path: `/notes/${note.id}`,
|
||||||
share: {
|
share: {
|
||||||
title: i18n.t("noteOf", {
|
title: i18n.t("noteOf", {
|
||||||
user: appearNote.user.name || appearNote.user.username,
|
user: note.user.name || note.user.username,
|
||||||
}),
|
}),
|
||||||
text: appearNote.text,
|
text: note.text,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: null
|
: null
|
||||||
|
|
Loading…
Reference in a new issue