logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 95c8232109f5e59273de48858ede7fbe7ce63d58
parent: 38e0133e1b01c21a710111097102a6eb205b9b9b
Author: Daniel King <northerner@users.noreply.github.com>
Date:   Mon,  5 Feb 2018 01:44:13 +0000

match hashtag regex in js client with server (#6431)

the slight mismatch in hashtag regex between js and ruby was causing
hashtag warning to be displayed for unlisted tweets when an invalid
hashtag was entered

exact version of ruby regex not possible in js as POSIX bracket
expressions are not supported, this version approximates and doesn't
give same unicode support

Diffstat:

Mapp/javascript/mastodon/features/compose/containers/warning_container.js2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/mastodon/features/compose/containers/warning_container.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { me } from '../../../initial_state'; -const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\S+)/i; +const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\w*[a-zA-Z]\w*)/i; const mapStateToProps = state => ({ needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),