Fix local-only flag not necessarily being preserved on delete & redraft

th-downstream
Thibaut Girka 4 years ago committed by ThibG
parent c4985a699d
commit 43bceb4337

@ -501,8 +501,11 @@ export default function compose(state = initialState, action) {
case COMPOSE_DOODLE_SET: case COMPOSE_DOODLE_SET:
return state.mergeIn(['doodle'], action.options); return state.mergeIn(['doodle'], action.options);
case REDRAFT: case REDRAFT:
const do_not_federate = action.status.get('local_only', false);
let text = action.raw_text || unescapeHTML(expandMentions(action.status));
if (do_not_federate) text = text.replace(/ ?👁\ufe0f?\u200b?$/, '');
return state.withMutations(map => { return state.withMutations(map => {
map.set('text', action.raw_text || unescapeHTML(expandMentions(action.status))); map.set('text', text);
map.set('content_type', action.content_type || 'text/plain'); 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'));
@ -511,6 +514,10 @@ export default function compose(state = initialState, action) {
map.set('caretPosition', null); map.set('caretPosition', null);
map.set('idempotencyKey', uuid()); map.set('idempotencyKey', uuid());
map.set('sensitive', action.status.get('sensitive')); map.set('sensitive', action.status.get('sensitive'));
map.update(
'advanced_options',
map => map.merge(new ImmutableMap({ do_not_federate }))
);
if (action.status.get('spoiler_text').length > 0) { if (action.status.get('spoiler_text').length > 0) {
map.set('spoiler', true); map.set('spoiler', true);

Loading…
Cancel
Save