From 71ea3ed425e1acd86642b9f2025c7dad10ac4aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Thu, 10 Mar 2022 18:47:20 +0100 Subject: [PATCH] Include media attachments when redrafting on Mastodon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/actions/statuses.js | 3 ++- app/soapbox/reducers/compose.js | 2 +- app/soapbox/utils/features.js | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/soapbox/actions/statuses.js b/app/soapbox/actions/statuses.js index b529e9b23..c0a8c58e5 100644 --- a/app/soapbox/actions/statuses.js +++ b/app/soapbox/actions/statuses.js @@ -101,13 +101,14 @@ export function redraft(status, raw_text) { return (dispatch, getState) => { const state = getState(); const instance = state.get('instance'); - const { explicitAddressing } = getFeatures(instance); + const { explicitAddressing, redraftMedia } = getFeatures(instance); dispatch({ type: REDRAFT, status, raw_text, explicitAddressing, + redraftMedia, }); }; } diff --git a/app/soapbox/reducers/compose.js b/app/soapbox/reducers/compose.js index 57796af63..405d92f7a 100644 --- a/app/soapbox/reducers/compose.js +++ b/app/soapbox/reducers/compose.js @@ -432,7 +432,7 @@ export default function compose(state = initialState, action) { map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('privacy', action.status.get('visibility')); // TODO: Actually fix this rather than just removing it - // map.set('media_attachments', action.status.get('media_attachments')); + if (action.redraftMedia) map.set('media_attachments', action.status.get('media_attachments')); map.set('focusDate', new Date()); map.set('caretPosition', null); map.set('idempotencyKey', uuid()); diff --git a/app/soapbox/utils/features.js b/app/soapbox/utils/features.js index 8f636eea0..f745cd0e7 100644 --- a/app/soapbox/utils/features.js +++ b/app/soapbox/utils/features.js @@ -110,6 +110,7 @@ export const getFeatures = createSelector([instance => instance], instance => { v.software === MASTODON && gte(v.compatVersion, '3.2.0'), v.software === PLEROMA && gte(v.version, '2.4.50'), ]), + redraftMedia: v.software === MASTODON, }, overrides); });