Support proper content-type in Delete & Redraft

This commit is contained in:
Thibaut Girka 2019-05-12 20:35:58 +02:00 committed by ThibG
parent f34a402a94
commit 93d98f62a8
2 changed files with 4 additions and 2 deletions

View file

@ -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 { return {
type: REDRAFT, type: REDRAFT,
status, status,
raw_text, raw_text,
content_type,
}; };
}; };
@ -94,7 +95,7 @@ export function deleteStatus(id, router, withRedraft = false) {
dispatch(deleteFromTimelines(id)); dispatch(deleteFromTimelines(id));
if (withRedraft) { if (withRedraft) {
dispatch(redraft(status, response.data.text)); dispatch(redraft(status, response.data.text, response.data.content_type));
if (!getState().getIn(['compose', 'mounted'])) { if (!getState().getIn(['compose', 'mounted'])) {
router.push('/statuses/new'); router.push('/statuses/new');

View file

@ -433,6 +433,7 @@ export default function compose(state = initialState, action) {
case REDRAFT: case REDRAFT:
return state.withMutations(map => { return state.withMutations(map => {
map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); 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('in_reply_to', action.status.get('in_reply_to_id'));
map.set('privacy', action.status.get('visibility')); map.set('privacy', action.status.get('visibility'));
map.set('media_attachments', action.status.get('media_attachments')); map.set('media_attachments', action.status.get('media_attachments'));