Merge branch 'develop' into feature/2024.10
This commit is contained in:
commit
6d4ae93592
54 changed files with 1630 additions and 20 deletions
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div :class="$style.root">
|
||||
<div v-if="!isDeleted" :class="$style.root">
|
||||
<MkAvatar :class="$style.avatar" :user="note.user" link preview/>
|
||||
<div :class="$style.main">
|
||||
<MkNoteHeader :class="$style.header" :note="note" :mini="true"/>
|
||||
|
|
@ -15,6 +15,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</p>
|
||||
<div v-show="note.cw == null || showContent">
|
||||
<MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note" :expandAllCws="props.expandAllCws"/>
|
||||
<div v-if="note.isSchedule" style="margin-top: 10px;">
|
||||
<MkButton :class="$style.button" inline @click.stop.prevent="editScheduleNote()"><i class="ti ti-eraser"></i> {{ i18n.ts.deleteAndEdit }}</MkButton>
|
||||
<MkButton :class="$style.button" inline danger @click.stop.prevent="deleteScheduleNote()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -24,18 +28,58 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as os from '@/os.js';
|
||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { defaultStore } from '@/store.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
const props = defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
note: Misskey.entities.Note & {
|
||||
isSchedule? : boolean,
|
||||
scheduledNoteId?: string
|
||||
};
|
||||
expandAllCws?: boolean;
|
||||
hideFiles?: boolean;
|
||||
}>();
|
||||
|
||||
let showContent = ref(defaultStore.state.uncollapseCW);
|
||||
const isDeleted = ref(false);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(ev: 'editScheduleNote'): void;
|
||||
}>();
|
||||
|
||||
async function deleteScheduleNote() {
|
||||
const { canceled } = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.deleteConfirm,
|
||||
okText: i18n.ts.delete,
|
||||
cancelText: i18n.ts.cancel,
|
||||
});
|
||||
if (canceled) return;
|
||||
await os.apiWithDialog('notes/schedule/delete', { noteId: props.note.id })
|
||||
.then(() => {
|
||||
isDeleted.value = true;
|
||||
});
|
||||
}
|
||||
|
||||
async function editScheduleNote() {
|
||||
await os.apiWithDialog('notes/schedule/delete', { noteId: props.note.id })
|
||||
.then(() => {
|
||||
isDeleted.value = true;
|
||||
});
|
||||
|
||||
await os.post({
|
||||
initialNote: props.note,
|
||||
renote: props.note.renote,
|
||||
reply: props.note.reply,
|
||||
channel: props.note.channel,
|
||||
});
|
||||
emit('editScheduleNote');
|
||||
}
|
||||
|
||||
watch(() => props.expandAllCws, (expandAllCws) => {
|
||||
if (expandAllCws !== showContent.value) showContent.value = expandAllCws;
|
||||
|
|
@ -50,6 +94,11 @@ watch(() => props.expandAllCws, (expandAllCws) => {
|
|||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
.button{
|
||||
margin-right: var(--margin);
|
||||
margin-bottom: var(--margin);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
flex-shrink: 0;
|
||||
display: block;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue