summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-21 10:00:09 -0400
committerGitHub <noreply@github.com>2016-07-21 10:00:09 -0400
commitbfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3 (patch)
tree6a51f8d4d144a181192499f5fd60ef82700e9abb /webapp
parentf0e9ec2dd127ffe34472c617f978173a8bf60b7c (diff)
downloadchat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.tar.gz
chat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.tar.bz2
chat-bfa04c0ab0eca5d812ad64e5f51e95ec458cf0d3.zip
PLT-2408 Adds here mention for online users (#3619)
* Added @here mention that notifies online users * Fixed existing race condition that would sometime cause clients to miss mention count changes * Added missing localization strings * Prevent @here from mentioning the user who posted it
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/suggestion/at_mention_provider.jsx12
-rw-r--r--webapp/i18n/en.json1
-rw-r--r--webapp/utils/constants.jsx2
-rw-r--r--webapp/utils/text_formatting.jsx1
4 files changed, 15 insertions, 1 deletions
diff --git a/webapp/components/suggestion/at_mention_provider.jsx b/webapp/components/suggestion/at_mention_provider.jsx
index b33662420..b9127e8d3 100644
--- a/webapp/components/suggestion/at_mention_provider.jsx
+++ b/webapp/components/suggestion/at_mention_provider.jsx
@@ -43,6 +43,15 @@ class AtMentionSuggestion extends Suggestion {
/>
);
icon = <i className='mention__image fa fa-users fa-2x'/>;
+ } else if (user.username === 'here') {
+ username = 'here';
+ description = (
+ <FormattedMessage
+ id='suggestion.mention.here'
+ defaultMessage='Notifies everyone in the channel and online'
+ />
+ );
+ icon = <i className='mention__image fa fa-users fa-2x'/>;
} else {
username = user.username;
@@ -126,6 +135,9 @@ export default class AtMentionProvider {
if ('all'.startsWith(prefix)) {
filtered.push({username: 'all'});
}
+ if ('here'.startsWith(prefix)) {
+ filtered.push({username: 'here'});
+ }
}
filtered.sort((a, b) => {
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index aee906818..ab7406d45 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -1410,6 +1410,7 @@
"sso_signup.team_error": "Please enter a team name",
"suggestion.mention.all": "Notifies everyone in the channel, use in {townsquare} to notify the whole team",
"suggestion.mention.channel": "Notifies everyone in the channel",
+ "suggestion.mention.here": "Notifies everyone in the channel and online",
"suggestion.search.private": "Private Groups",
"suggestion.search.public": "Public Channels",
"team_export_tab.download": "download",
diff --git a/webapp/utils/constants.jsx b/webapp/utils/constants.jsx
index f0b3f30c9..207ec5811 100644
--- a/webapp/utils/constants.jsx
+++ b/webapp/utils/constants.jsx
@@ -217,7 +217,7 @@ export const Constants = {
ONLINE: 'online'
},
- SPECIAL_MENTIONS: ['all', 'channel'],
+ SPECIAL_MENTIONS: ['all', 'channel', 'here'],
CHARACTER_LIMIT: 4000,
IMAGE_TYPES: ['jpg', 'gif', 'bmp', 'png', 'jpeg'],
AUDIO_TYPES: ['mp3', 'wav', 'wma', 'm4a', 'flac', 'aac', 'ogg'],
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index 5ada7727f..b304fa75a 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -207,6 +207,7 @@ function highlightCurrentMentions(text, tokens) {
let output = text;
const mentionKeys = UserStore.getCurrentMentionKeys();
+ mentionKeys.push('@here');
// look for any existing tokens which are self mentions and should be highlighted
var newTokens = new Map();