fix: don't show quoted toast on cancel of quote note

This commit is contained in:
Marie 2024-09-16 00:35:26 +02:00
parent bde6bb0bd2
commit e21e2530e6
No known key found for this signature in database
GPG Key ID: 7ADF6C9CD9A28555
8 changed files with 36 additions and 18 deletions

View File

@ -565,7 +565,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,
@ -589,7 +590,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,

View File

@ -550,7 +550,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,
@ -574,7 +575,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,

View File

@ -339,7 +339,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: props.note.id,
userId: $i.id,
@ -363,7 +364,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: props.note.id,
userId: $i.id,

View File

@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<MkModal ref="modal" :preferType="'dialog'" @click="modal?.close()" @closed="onModalClosed()" @esc="modal?.close()">
<MkPostForm ref="form" :class="$style.form" v-bind="props" autofocus freezeAfterPosted @posted="onPosted" @cancel="modal?.close()" @esc="modal?.close()"/>
<MkPostForm ref="form" :class="$style.form" v-bind="props" autofocus freezeAfterPosted @posted="onPosted" @cancel="onCancel" @esc="modal?.close()"/>
</MkModal>
</template>
@ -37,7 +37,7 @@ const props = withDefaults(defineProps<{
});
const emit = defineEmits<{
(ev: 'closed'): void;
(ev: 'closed', cancelled: boolean): void;
}>();
const modal = shallowRef<InstanceType<typeof MkModal>>();
@ -47,10 +47,16 @@ function onPosted() {
modal.value?.close({
useSendAnimation: true,
});
emit('closed', false);
}
function onCancel() {
modal.value?.close();
emit('closed', true);
}
function onModalClosed() {
emit('closed');
emit('closed', true);
}
</script>

View File

@ -565,7 +565,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,
@ -589,7 +590,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,

View File

@ -559,7 +559,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,
@ -583,7 +584,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: appearNote.value.id,
userId: $i?.id,

View File

@ -353,7 +353,8 @@ function quote() {
os.post({
renote: appearNote.value,
channel: appearNote.value.channel,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: props.note.id,
userId: $i.id,
@ -377,7 +378,8 @@ function quote() {
} else {
os.post({
renote: appearNote.value,
}).then(() => {
}).then((cancelled) => {
if (cancelled) return;
misskeyApi('notes/renotes', {
noteId: props.note.id,
userId: $i.id,

View File

@ -691,7 +691,7 @@ export function contextMenu(items: MenuItem[], ev: MouseEvent): Promise<void> {
}));
}
export function post(props: Record<string, any> = {}): Promise<void> {
export function post(props: Record<string, any> = {}): Promise<void | boolean> {
pleaseLogin(undefined, (props.initialText || props.initialNote ? {
type: 'share',
params: {
@ -709,8 +709,8 @@ export function post(props: Record<string, any> = {}): Promise<void> {
// 複数のpost formを開いたときに場合によってはエラーになる
// もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが
const { dispose } = popup(MkPostFormDialog, props, {
closed: () => {
resolve();
closed: (cancelled) => {
resolve(cancelled);
dispose();
},
});