Fix the hashtag judgment of the compose form to be the same as the server side (#14484)
parent
d6f2d1d3f2
commit
a903875e3c
|
@ -5,7 +5,22 @@ import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { me } from '../../../initial_state';
|
import { me } from '../../../initial_state';
|
||||||
|
|
||||||
const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;
|
const HASHTAG_SEPARATORS = "_\\u00b7\\u200c";
|
||||||
|
const ALPHA = '\\p{L}\\p{M}';
|
||||||
|
const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}';
|
||||||
|
const APPROX_HASHTAG_RE = new RegExp(
|
||||||
|
'(?:^|[^\\/\\)\\w])#((' +
|
||||||
|
'[' + WORD + '_]' +
|
||||||
|
'[' + WORD + HASHTAG_SEPARATORS + ']*' +
|
||||||
|
'[' + ALPHA + HASHTAG_SEPARATORS + ']' +
|
||||||
|
'[' + WORD + HASHTAG_SEPARATORS +']*' +
|
||||||
|
'[' + WORD + '_]' +
|
||||||
|
')|(' +
|
||||||
|
'[' + WORD + '_]*' +
|
||||||
|
'[' + ALPHA + ']' +
|
||||||
|
'[' + WORD + '_]*' +
|
||||||
|
'))', 'iu'
|
||||||
|
);
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
|
needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
|
||||||
|
|
Loading…
Reference in New Issue