diff --git a/src/components/compose.jsx b/src/components/compose.jsx index 21bf5ea2..b9118354 100644 --- a/src/components/compose.jsx +++ b/src/components/compose.jsx @@ -23,6 +23,7 @@ import showToast from '../utils/show-toast'; import states, { saveStatus } from '../utils/states'; import store from '../utils/store'; import { + getAPIVersions, getCurrentAccount, getCurrentAccountNS, getCurrentInstanceConfiguration, @@ -178,6 +179,8 @@ function Compose({ const prefs = getPreferences(); + const supportsNativeQuote = getAPIVersions()?.mastodon >= 7; + const oninputTextarea = () => { if (!textareaRef.current) return; textareaRef.current.dispatchEvent(new Event('input')); @@ -595,9 +598,11 @@ function Compose({ scheduledAt, quoteApprovalPolicy, }, - quoteStatus: { - ...quoteStatus, - }, + quoteStatus: quoteStatus + ? { + ...quoteStatus, + } + : null, }; if ( !deepEqual(backgroundDraft, prevBackgroundDraft.current) && @@ -1204,18 +1209,23 @@ function Compose({ params.quoted_status_id = quoteStatus.id; params.quote_approval_policy = quoteApprovalPolicy; } - if (editStatus && supports('@mastodon/edit-media-attributes')) { - params.media_attributes = mediaAttachments.map( - (attachment) => { - return { - id: attachment.id, - description: attachment.description, - // focus - // thumbnail - }; - }, - ); - } else if (!editStatus) { + if (editStatus) { + if (supportsNativeQuote) { + params.quote_approval_policy = quoteApprovalPolicy; + } + if (supports('@mastodon/edit-media-attributes')) { + params.media_attributes = mediaAttachments.map( + (attachment) => { + return { + id: attachment.id, + description: attachment.description, + // focus + // thumbnail + }; + }, + ); + } + } else { params.visibility = visibility; // params.inReplyToId = replyToStatus?.id || undefined; params.in_reply_to_id = replyToStatus?.id || undefined; @@ -1674,36 +1684,38 @@ function Compose({ hidden={uiState === 'loading'} /> )} - + + {quoteApprovalPolicy === 'followers' && ( + + )} + {quoteApprovalPolicy === 'nobody' && ( + + )} + + + )}