Limits hashtag linking to a minimum of three characters

This commit is contained in:
Reed Garmsen
2016-02-05 14:08:05 -08:00
parent 29b5821c40
commit cf9052d284
2 changed files with 9 additions and 2 deletions

View File

@@ -467,5 +467,6 @@ export default {
MAX_USERNAME_LENGTH: 15,
MIN_PASSWORD_LENGTH: 5,
MAX_PASSWORD_LENGTH: 50,
TIME_SINCE_UPDATE_INTERVAL: 30000
TIME_SINCE_UPDATE_INTERVAL: 30000,
MIN_HASHTAG_LINK_LENGTH: 3
};

View File

@@ -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
});