[Glitch] Use raw content if available on Delete & Redraft

Port front-end changes from 6d44f2441b to glitch-soc
main
ThibG 6 years ago committed by Thibaut Girka
parent 2b97d9d780
commit 93085c273c

@ -71,10 +71,11 @@ export function fetchStatusFail(id, error, skipLoading) {
}; };
}; };
export function redraft(status) { export function redraft(status, raw_text) {
return { return {
type: REDRAFT, type: REDRAFT,
status, status,
raw_text,
}; };
}; };
@ -88,12 +89,12 @@ export function deleteStatus(id, router, withRedraft = false) {
dispatch(deleteStatusRequest(id)); dispatch(deleteStatusRequest(id));
api(getState).delete(`/api/v1/statuses/${id}`).then(() => { api(getState).delete(`/api/v1/statuses/${id}`).then(response => {
dispatch(deleteStatusSuccess(id)); dispatch(deleteStatusSuccess(id));
dispatch(deleteFromTimelines(id)); dispatch(deleteFromTimelines(id));
if (withRedraft) { if (withRedraft) {
dispatch(redraft(status)); dispatch(redraft(status, response.data.text));
if (!getState().getIn(['compose', 'mounted'])) { if (!getState().getIn(['compose', 'mounted'])) {
router.push('/statuses/new'); router.push('/statuses/new');

@ -426,7 +426,7 @@ export default function compose(state = initialState, action) {
return state.mergeIn(['doodle'], action.options); return state.mergeIn(['doodle'], action.options);
case REDRAFT: case REDRAFT:
return state.withMutations(map => { return state.withMutations(map => {
map.set('text', unescapeHTML(expandMentions(action.status))); map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status)));
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'));

Loading…
Cancel
Save