diff options
Diffstat (limited to 'web/react/utils')
-rw-r--r-- | web/react/utils/constants.jsx | 3 | ||||
-rw-r--r-- | web/react/utils/text_formatting.jsx | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/web/react/utils/constants.jsx b/web/react/utils/constants.jsx index 64d4ea8a1..d78776aa3 100644 --- a/web/react/utils/constants.jsx +++ b/web/react/utils/constants.jsx @@ -467,5 +467,6 @@ export default { MAX_USERNAME_LENGTH: 64, MIN_PASSWORD_LENGTH: 5, MAX_PASSWORD_LENGTH: 50, - TIME_SINCE_UPDATE_INTERVAL: 30000 + TIME_SINCE_UPDATE_INTERVAL: 30000, + MIN_HASHTAG_LINK_LENGTH: 3 }; diff --git a/web/react/utils/text_formatting.jsx b/web/react/utils/text_formatting.jsx index e837ded53..dae2252a6 100644 --- a/web/react/utils/text_formatting.jsx +++ b/web/react/utils/text_formatting.jsx @@ -248,8 +248,14 @@ function autolinkHashtags(text, tokens) { const index = tokens.size; const alias = `MM_HASHTAG${index}`; + let value = hashtag; + + if (hashtag.length > Constants.MIN_HASHTAG_LINK_LENGTH) { + value = `<a class='mention-link' href='#' data-hashtag='${hashtag}'>${hashtag}</a>`; + } + tokens.set(alias, { - value: `<a class='mention-link' href='#' data-hashtag='${hashtag}'>${hashtag}</a>`, + value, originalText: hashtag }); |