summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/emoticons.jsx4
-rw-r--r--webapp/utils/markdown.jsx2
-rw-r--r--webapp/utils/text_formatting.jsx4
-rw-r--r--webapp/utils/utils.jsx16
4 files changed, 11 insertions, 15 deletions
diff --git a/webapp/utils/emoticons.jsx b/webapp/utils/emoticons.jsx
index ba54d8cb3..7280ef88b 100644
--- a/webapp/utils/emoticons.jsx
+++ b/webapp/utils/emoticons.jsx
@@ -12,7 +12,7 @@ export const emoticonPatterns = {
smile: /(^|\s)(:-?d)(?=$|\s)/gi, // :D
stuck_out_tongue_closed_eyes: /(^|\s)(x-d)(?=$|\s)/gi, // x-d
stuck_out_tongue: /(^|\s)(:-?p)(?=$|\s)/gi, // :p
- rage: /(^|\s)(:-?[\[@])(?=$|\s)/g, // :@
+ rage: /(^|\s)(:-?[[@])(?=$|\s)/g, // :@
slightly_frowning_face: /(^|\s)(:-?\()(?=$|\s)/g, // :(
cry: /(^|\s)(:['’]-?\(|:'\(|:'\()(?=$|\s)/g, // :`(
confused: /(^|\s)(:-?\/)(?=$|\s)/g, // :/
@@ -23,7 +23,7 @@ export const emoticonPatterns = {
heart: /(^|\s)(<3|&lt;3)(?=$|\s)/g, // <3
broken_heart: /(^|\s)(<\/3|&lt;&#x2F;3)(?=$|\s)/g, // </3
thumbsup: /(^|\s)(:\+1:)(?=$|\s)/g, // :+1:
- thumbsdown: /(^|\s)(:\-1:)(?=$|\s)/g // :-1:
+ thumbsdown: /(^|\s)(:-1:)(?=$|\s)/g // :-1:
};
export function handleEmoticons(text, tokens, emojis) {
diff --git a/webapp/utils/markdown.jsx b/webapp/utils/markdown.jsx
index 0b279ca6d..8a0b9ef0a 100644
--- a/webapp/utils/markdown.jsx
+++ b/webapp/utils/markdown.jsx
@@ -197,7 +197,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
}
listitem(text, bullet) {
- const taskListReg = /^\[([ |xX])\] /;
+ const taskListReg = /^\[([ |xX])] /;
const isTaskList = taskListReg.exec(text);
if (isTaskList) {
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 5caad05c3..9c2edf954 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -249,7 +249,7 @@ function autolinkChannelMentions(text, tokens, channelNamesMap, team) {
}
export function escapeRegex(text) {
- return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+ return text.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
}
function highlightCurrentMentions(text, tokens, mentionKeys = []) {
@@ -386,7 +386,7 @@ function parseSearchTerms(searchTerm) {
termString = termString.substring(captured[0].length);
// break the text up into words based on how the server splits them in SqlPostStore.SearchPosts and then discard empty terms
- terms.push(...captured[0].split(/[ <>+\(\)~@]/).filter((term) => Boolean(term)));
+ terms.push(...captured[0].split(/[ <>+()~@]/).filter((term) => Boolean(term)));
continue;
}
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 7a609a2d1..248fabd9a 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -30,8 +30,8 @@ export function isEmail(email) {
export function cleanUpUrlable(input) {
var cleaned = input.trim().replace(/-/g, ' ').replace(/[^\w\s]/gi, '').toLowerCase().replace(/\s/g, '-');
cleaned = cleaned.replace(/-{2,}/, '-');
- cleaned = cleaned.replace(/^\-+/, '');
- cleaned = cleaned.replace(/\-+$/, '');
+ cleaned = cleaned.replace(/^-+/, '');
+ cleaned = cleaned.replace(/-+$/, '');
return cleaned;
}
@@ -135,7 +135,6 @@ export function ding() {
canDing = false;
setTimeout(() => {
canDing = true;
- return;
}, 3000);
}
}
@@ -194,14 +193,14 @@ export function getTimestamp() {
// extracts links not styled by Markdown
export function extractFirstLink(text) {
- const pattern = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[\-A-Z0-9+\u0026\u2019@#\/%?=()~_|!:,.;]*[\-A-Z0-9+\u0026@#\/%=~()_|])/i;
+ const pattern = /(^|[\s\n]|<br\/?>)((?:https?|ftp):\/\/[-A-Z0-9+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/i;
let inText = text;
// strip out code blocks
inText = inText.replace(/`[^`]*`/g, '');
// strip out inline markdown images
- inText = inText.replace(/!\[[^\]]*\]\([^\)]*\)/g, '');
+ inText = inText.replace(/!\[[^\]]*]\([^)]*\)/g, '');
const match = pattern.exec(inText);
if (match) {
@@ -212,7 +211,7 @@ export function extractFirstLink(text) {
}
export function escapeRegExp(string) {
- return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
+ return string.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
}
// Taken from http://stackoverflow.com/questions/1068834/object-comparison-in-javascript and modified slightly
@@ -708,7 +707,6 @@ export function updateCodeTheme(userTheme) {
element.themes.forEach((theme) => {
if (userTheme === theme.id) {
cssPath = theme.cssURL;
- return;
}
});
}
@@ -736,8 +734,6 @@ export function placeCaretAtEnd(el) {
el.focus();
el.selectionStart = el.value.length;
el.selectionEnd = el.value.length;
-
- return;
}
export function getCaretPosition(el) {
@@ -799,7 +795,7 @@ export function isValidUsername(name) {
error = 'This field is required';
} else if (name.length < Constants.MIN_USERNAME_LENGTH || name.length > Constants.MAX_USERNAME_LENGTH) {
error = 'Must be between ' + Constants.MIN_USERNAME_LENGTH + ' and ' + Constants.MAX_USERNAME_LENGTH + ' characters';
- } else if (!(/^[a-z0-9\.\-_]+$/).test(name)) {
+ } else if (!(/^[a-z0-9.\-_]+$/).test(name)) {
error = "Must contain only letters, numbers, and the symbols '.', '-', and '_'.";
} else if (!(/[a-z]/).test(name.charAt(0))) { //eslint-disable-line no-negated-condition
error = 'First character must be a letter.';