From b5e6e77ca4c13a980b665d4af0bb3f02ecb1145e Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Sun, 10 Mar 2019 02:44:00 +0000 Subject: glitch: fix local only matching --- app/javascript/flavours/glitch/actions/compose.js | 4 +++- app/javascript/flavours/glitch/reducers/compose.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/javascript/flavours/glitch/actions/compose.js b/app/javascript/flavours/glitch/actions/compose.js index 103d7aefa..ab4277f54 100644 --- a/app/javascript/flavours/glitch/actions/compose.js +++ b/app/javascript/flavours/glitch/actions/compose.js @@ -144,7 +144,9 @@ export function submitCompose(routerHistory) { dispatch(submitComposeRequest()); if (getState().getIn(['compose', 'advanced_options', 'do_not_federate'])) { - status = status + ' #!'; + if (!/(?:#|#|#)(?:!|!|!)(?:<\/p>)?$/.test(status)) { + status = status + ' #!'; + } } api(getState).post('/api/v1/statuses', { status, diff --git a/app/javascript/flavours/glitch/reducers/compose.js b/app/javascript/flavours/glitch/reducers/compose.js index e9d59e366..56872f7a7 100644 --- a/app/javascript/flavours/glitch/reducers/compose.js +++ b/app/javascript/flavours/glitch/reducers/compose.js @@ -177,7 +177,7 @@ function continueThread (state, status) { map.set('in_reply_to', status.id); map.update( 'advanced_options', - map => map.merge(new ImmutableMap({ do_not_federate: /#!\u200b?(?:<\/p>)?$/.test(status.content) })) + map => map.merge(new ImmutableMap({ do_not_federate: /(?:#|#|#)(?:!|!|!)(?:<\/p>)?$/.test(status.content) })) ); map.set('privacy', status.visibility); map.set('sensitive', false); @@ -331,7 +331,7 @@ export default function compose(state = initialState, action) { map.set('privacy', privacyPreference(action.status.get('visibility'), state.get('default_privacy'))); map.update( 'advanced_options', - map => map.merge(new ImmutableMap({ do_not_federate: /#!(?:<\/p>)?$/.test(action.status.get('content')) })) + map => map.merge(new ImmutableMap({ do_not_federate: /(?:#|#|#)(?:!|!|!)(?:<\/p>)?$/.test(action.status.get('content')) })) ); map.set('focusDate', new Date()); map.set('caretPosition', null); -- cgit