about summary refs log tree commit diff
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-03-10 02:44:00 +0000
committermultiple creatures <dev@multiple-creature.party>2019-05-21 03:16:21 -0500
commitb5e6e77ca4c13a980b665d4af0bb3f02ecb1145e (patch)
tree5aa1e4937c15062d7f4cf9c4fc85d6e2d9f2eeef
parentf21d4c3209d7c1d3ea533b61945e0fab92951e3b (diff)
glitch: fix local only matching
-rw-r--r--app/javascript/flavours/glitch/actions/compose.js4
-rw-r--r--app/javascript/flavours/glitch/reducers/compose.js4
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 (!/(?:#|&num;|&#35;)(?:!|&excl;|&#33;)(?:<\/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: /(?:#|&num;|&#35;)(?:!|&excl;|&#33;)(?:<\/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: /(?:#|&num;|&#35;)(?:!|&excl;|&#33;)(?:<\/p>)?$/.test(action.status.get('content')) }))
       );
       map.set('focusDate', new Date());
       map.set('caretPosition', null);