fix: don't show quoted toast on cancel of quote note
This commit is contained in:
parent
bde6bb0bd2
commit
e21e2530e6
8 changed files with 36 additions and 18 deletions
|
@ -565,7 +565,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
@ -589,7 +590,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
|
|
@ -550,7 +550,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
@ -574,7 +575,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
|
|
@ -339,7 +339,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: $i.id,
|
||||||
|
@ -363,7 +364,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: $i.id,
|
||||||
|
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MkModal ref="modal" :preferType="'dialog'" @click="modal?.close()" @closed="onModalClosed()" @esc="modal?.close()">
|
<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>
|
</MkModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ const props = withDefaults(defineProps<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(ev: 'closed'): void;
|
(ev: 'closed', cancelled: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||||
|
@ -47,10 +47,16 @@ function onPosted() {
|
||||||
modal.value?.close({
|
modal.value?.close({
|
||||||
useSendAnimation: true,
|
useSendAnimation: true,
|
||||||
});
|
});
|
||||||
|
emit('closed', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onCancel() {
|
||||||
|
modal.value?.close();
|
||||||
|
emit('closed', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onModalClosed() {
|
function onModalClosed() {
|
||||||
emit('closed');
|
emit('closed', true);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
@ -589,7 +590,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
|
|
@ -559,7 +559,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
@ -583,7 +584,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: appearNote.value.id,
|
noteId: appearNote.value.id,
|
||||||
userId: $i?.id,
|
userId: $i?.id,
|
||||||
|
|
|
@ -353,7 +353,8 @@ function quote() {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
channel: appearNote.value.channel,
|
channel: appearNote.value.channel,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: $i.id,
|
||||||
|
@ -377,7 +378,8 @@ function quote() {
|
||||||
} else {
|
} else {
|
||||||
os.post({
|
os.post({
|
||||||
renote: appearNote.value,
|
renote: appearNote.value,
|
||||||
}).then(() => {
|
}).then((cancelled) => {
|
||||||
|
if (cancelled) return;
|
||||||
misskeyApi('notes/renotes', {
|
misskeyApi('notes/renotes', {
|
||||||
noteId: props.note.id,
|
noteId: props.note.id,
|
||||||
userId: $i.id,
|
userId: $i.id,
|
||||||
|
|
|
@ -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 ? {
|
pleaseLogin(undefined, (props.initialText || props.initialNote ? {
|
||||||
type: 'share',
|
type: 'share',
|
||||||
params: {
|
params: {
|
||||||
|
@ -709,8 +709,8 @@ export function post(props: Record<string, any> = {}): Promise<void> {
|
||||||
// 複数のpost formを開いたときに場合によってはエラーになる
|
// 複数のpost formを開いたときに場合によってはエラーになる
|
||||||
// もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが
|
// もちろん複数のpost formを開けること自体Misskeyサイドのバグなのだが
|
||||||
const { dispose } = popup(MkPostFormDialog, props, {
|
const { dispose } = popup(MkPostFormDialog, props, {
|
||||||
closed: () => {
|
closed: (cancelled) => {
|
||||||
resolve();
|
resolve(cancelled);
|
||||||
dispose();
|
dispose();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue