From 8a49df8ede8fa2c8b61fe758813859b6dba3b6dd Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 12 May 2019 20:35:58 +0200 Subject: [PATCH] Support proper content-type in Delete & Redraft --- app/javascript/flavours/glitch/actions/statuses.js | 5 +++-- app/javascript/flavours/glitch/reducers/compose.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/statuses.js b/app/javascript/flavours/glitch/actions/statuses.js index 550fe510fc..7e22a7f988 100644 --- a/app/javascript/flavours/glitch/actions/statuses.js +++ b/app/javascript/flavours/glitch/actions/statuses.js @@ -71,11 +71,12 @@ export function fetchStatusFail(id, error, skipLoading) { }; }; -export function redraft(status, raw_text) { +export function redraft(status, raw_text, content_type) { return { type: REDRAFT, status, raw_text, + content_type, }; }; @@ -94,7 +95,7 @@ export function deleteStatus(id, router, withRedraft = false) { dispatch(deleteFromTimelines(id)); if (withRedraft) { - dispatch(redraft(status, response.data.text)); + dispatch(redraft(status, response.data.text, response.data.content_type)); if (!getState().getIn(['compose', 'mounted'])) { router.push('/statuses/new'); diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index 516da859aa..82facb1e2e 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -433,6 +433,7 @@ export default function compose(state = initialState, action) { case REDRAFT: return state.withMutations(map => { map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); + map.set('content_type', action.content_type || 'text/plain'); map.set('in_reply_to', action.status.get('in_reply_to_id')); map.set('privacy', action.status.get('visibility')); map.set('media_attachments', action.status.get('media_attachments'));