From 9571d7338a824865e3ddad7be52587c657b806ea Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 13 Jan 2023 01:33:04 +0100 Subject: [PATCH] feat: separate metions lines on replying --- components/publish/PublishWidget.vue | 6 ++++++ composables/masto/publish.ts | 6 +++++- composables/masto/statusDrafts.ts | 9 ++++----- types/index.ts | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/publish/PublishWidget.vue b/components/publish/PublishWidget.vue index 84f1f52c..02e0e97a 100644 --- a/components/publish/PublishWidget.vue +++ b/components/publish/PublishWidget.vue @@ -120,6 +120,12 @@ defineExpose({ border="2 dashed transparent" :class="[isSending ? 'pointer-events-none' : '', isOverDropZone ? '!border-primary' : '']" > + +
+ @{{ m }} +
+
+
`@${i}`).join(' ')} ${content}` + const payload = { ...draft.params, - status: htmlToText(draft.params.status || ''), + status: content, mediaIds: draft.attachments.map(a => a.id), ...(isGlitchEdition.value ? { 'content-type': 'text/markdown' } : {}), } as mastodon.v1.CreateStatusParams diff --git a/composables/masto/statusDrafts.ts b/composables/masto/statusDrafts.ts index a8d9a06d..6603b63e 100644 --- a/composables/masto/statusDrafts.ts +++ b/composables/masto/statusDrafts.ts @@ -21,6 +21,7 @@ export function getDefaultDraft(options: Partial `@${acct}`).join(' ') -} - function getAccountsToMention(status: mastodon.v1.Status) { const userId = currentUser.value?.account.id const accountsToMention = new Set() @@ -72,9 +70,10 @@ export function getReplyDraft(status: mastodon.v1.Status) { key: `reply-${status.id}`, draft: () => { return getDefaultDraft({ - initialText: toMentionsHTML(accountsToMention), + initialText: '', inReplyToId: status!.id, visibility: status.visibility, + mentions: accountsToMention, }) }, } diff --git a/types/index.ts b/types/index.ts index 4d89faf5..b3bc902e 100644 --- a/types/index.ts +++ b/types/index.ts @@ -56,7 +56,9 @@ export interface Draft { params: MarkNonNullable, 'status' | 'language' | 'sensitive' | 'spoilerText' | 'visibility'> attachments: mastodon.v1.MediaAttachment[] lastUpdated: number + mentions?: string[] } + export type DraftMap = Record export interface ConfirmDialogLabel {