summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/channel_intro_messages.jsx2
-rw-r--r--webapp/utils/post_utils.jsx6
-rw-r--r--webapp/utils/text_formatting.jsx13
3 files changed, 18 insertions, 3 deletions
diff --git a/webapp/utils/channel_intro_messages.jsx b/webapp/utils/channel_intro_messages.jsx
index 0c011734a..991bf54e8 100644
--- a/webapp/utils/channel_intro_messages.jsx
+++ b/webapp/utils/channel_intro_messages.jsx
@@ -48,7 +48,7 @@ export function createDMIntroMessage(channel, centeredIntro) {
<div className={'channel-intro ' + centeredIntro}>
<div className='post-profile-img__container channel-intro-img'>
<ProfilePicture
- src={Client.getUsersRoute() + '/' + teammate.id + '/image?time=' + teammate.update_at}
+ src={Client.getUsersRoute() + '/' + teammate.id + '/image?time=' + teammate.last_picture_update}
width='50'
height='50'
user={teammate}
diff --git a/webapp/utils/post_utils.jsx b/webapp/utils/post_utils.jsx
index 4bba784cb..88021c2a5 100644
--- a/webapp/utils/post_utils.jsx
+++ b/webapp/utils/post_utils.jsx
@@ -15,6 +15,10 @@ export function isComment(post) {
return false;
}
+export function isEdited(post) {
+ return post.edit_at > 0;
+}
+
export function getProfilePicSrcForPost(post, timestamp) {
let src = Client.getUsersRoute() + '/' + post.user_id + '/image?time=' + timestamp;
if (post.props && post.props.from_webhook && global.window.mm_config.EnablePostIconOverride === 'true') {
@@ -28,4 +32,4 @@ export function getProfilePicSrcForPost(post, timestamp) {
}
return src;
-} \ No newline at end of file
+}
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 9f983a1ee..171226558 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -395,7 +395,13 @@ function parseSearchTerms(searchTerm) {
}
// remove punctuation from each term
- terms = terms.map((term) => term.replace(puncStart, '').replace(puncEnd, ''));
+ terms = terms.map((term) => {
+ term.replace(puncStart, '');
+ if (term.charAt(term.length - 1) !== '*') {
+ term.replace(puncEnd, '');
+ }
+ return term;
+ });
return terms;
}
@@ -452,6 +458,11 @@ export function highlightSearchTerms(text, tokens, searchPatterns) {
output = output.replace(alias, newAlias);
}
+
+ // The pattern regexes are global, so calling pattern.test() above alters their
+ // state. Reset lastIndex to 0 between calls to test() to ensure it returns the
+ // same result every time it is called with the same value of token.originalText.
+ pattern.lastIndex = 0;
}
// the new tokens are stashed in a separate map since we can't add objects to a map during iteration