From e21e2530e6067c1d5ba2b9f49c03333ef94367bc Mon Sep 17 00:00:00 2001
From: Marie <github@yuugi.dev>
Date: Mon, 16 Sep 2024 00:35:26 +0200
Subject: fix: don't show quoted toast on cancel of quote note

---
 packages/frontend/src/components/MkPostFormDialog.vue | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 'packages/frontend/src/components/MkPostFormDialog.vue')

diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue
index 947c0ee4d0..cc84c6e0ff 100644
--- a/packages/frontend/src/components/MkPostFormDialog.vue
+++ b/packages/frontend/src/components/MkPostFormDialog.vue
@@ -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>
 
-- 
cgit v1.2.3-freya


From 730bdab5fa640b34f6d1bb89ecbefc8e4135aa32 Mon Sep 17 00:00:00 2001
From: Marie <github@yuugi.dev>
Date: Sat, 21 Sep 2024 18:04:31 +0000
Subject: upd: add onCancel to esc

---
 packages/frontend/src/components/MkPostFormDialog.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'packages/frontend/src/components/MkPostFormDialog.vue')

diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue
index cc84c6e0ff..116ea86873 100644
--- a/packages/frontend/src/components/MkPostFormDialog.vue
+++ b/packages/frontend/src/components/MkPostFormDialog.vue
@@ -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="onCancel" @esc="modal?.close()"/>
+	<MkPostForm ref="form" :class="$style.form" v-bind="props" autofocus freezeAfterPosted @posted="onPosted" @cancel="onCancel" @esc="onCancel"/>
 </MkModal>
 </template>
 
-- 
cgit v1.2.3-freya


From 321e7daab53a91464b9fd2f91f365dd01f42a9da Mon Sep 17 00:00:00 2001
From: Marie <github@yuugi.dev>
Date: Wed, 2 Oct 2024 17:26:23 +0200
Subject: chore: add comments

---
 packages/frontend/src/components/MkPostFormDialog.vue | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'packages/frontend/src/components/MkPostFormDialog.vue')

diff --git a/packages/frontend/src/components/MkPostFormDialog.vue b/packages/frontend/src/components/MkPostFormDialog.vue
index 116ea86873..811a6378f2 100644
--- a/packages/frontend/src/components/MkPostFormDialog.vue
+++ b/packages/frontend/src/components/MkPostFormDialog.vue
@@ -51,7 +51,9 @@ function onPosted() {
 }
 
 function onCancel() {
+	// for some reason onModalClosed does not get called properly when closing the model through other functions.
 	modal.value?.close();
+	// emit is required so that the dialog gets properly disposed otherwise it will float around as a "zombie"
 	emit('closed', true);
 }
 
-- 
cgit v1.2.3-freya

