From 1817afdb234472db1b4c57768c8a2cc68a0d4da1 Mon Sep 17 00:00:00 2001 From: Piotrek Tomczewski Date: Sat, 7 Jan 2023 23:18:15 +0100 Subject: [PATCH] feat(reply): navigate to thread on publish (#852) --- components/publish/PublishWidget.vue | 2 ++ components/status/StatusActions.vue | 3 +-- composables/status.ts | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 composables/status.ts diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 1c9a937e..2cc8ca50 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -159,6 +159,8 @@ async function publish() { status = await masto.statuses.create(payload) else status = await masto.statuses.update(draft.editingStatus.id, payload) + if (draft.params.inReplyToId) + navigateToStatus({ status }) draft = initial() emit('published', status) diff --git a/components/status/StatusActions.vue b/components/status/StatusActions.vue index 1cc8c0b2..b56810d5 100644 --- a/components/status/StatusActions.vue +++ b/components/status/StatusActions.vue @@ -26,9 +26,8 @@ const reply = () => { return if (details) focusEditor() - else - navigateTo({ path: getStatusRoute(status).href, state: { focusReply: true } }) + navigateToStatus({ status, focusReply: true }) } diff --git a/composables/status.ts b/composables/status.ts new file mode 100644 index 00000000..3761ab04 --- /dev/null +++ b/composables/status.ts @@ -0,0 +1,3 @@ +import type { Status } from 'masto' + +export const navigateToStatus = ({ status, focusReply = false }: { status: Status; focusReply?: boolean }) => navigateTo({ path: getStatusRoute(status).href, state: { focusReply } })