summaryrefslogtreecommitdiffstats
path: root/webapp/utils/utils.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2017-06-20 15:22:46 -0400
committerGitHub <noreply@github.com>2017-06-20 15:22:46 -0400
commit68ea0abfa665144164041c9421899bfc21412f8a (patch)
tree5d2f2aa5665a084bd1e544d8342e229a8fafc064 /webapp/utils/utils.jsx
parent270fc41c0ffe52266f821748db9fd8b4e9d10b36 (diff)
downloadchat-68ea0abfa665144164041c9421899bfc21412f8a.tar.gz
chat-68ea0abfa665144164041c9421899bfc21412f8a.tar.bz2
chat-68ea0abfa665144164041c9421899bfc21412f8a.zip
PLT-4457 Added AtMention component to better render at mentions (#6563)
* Moved Utils.searchForTerm into an action * Added easier importing of index.jsx files * PLT-4457 Added AtMention component to better render at mentions * Fixed client unit tests * Fixed merge conflict * Fixed merge conflicts
Diffstat (limited to 'webapp/utils/utils.jsx')
-rw-r--r--webapp/utils/utils.jsx24
1 files changed, 10 insertions, 14 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 84b02beb1..6ef267eed 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -388,14 +388,6 @@ export function insertHtmlEntities(text) {
return newtext;
}
-export function searchForTerm(term) {
- AppDispatcher.handleServerAction({
- type: ActionTypes.RECEIVED_SEARCH_TERM,
- term,
- do_search: true
- });
-}
-
export function getFileType(extin) {
var ext = extin.toLowerCase();
if (Constants.IMAGE_TYPES.indexOf(ext) > -1) {
@@ -1312,16 +1304,11 @@ export function isValidPassword(password) {
}
export function handleFormattedTextClick(e) {
- const mentionAttribute = e.target.getAttributeNode('data-mention');
const hashtagAttribute = e.target.getAttributeNode('data-hashtag');
const linkAttribute = e.target.getAttributeNode('data-link');
const channelMentionAttribute = e.target.getAttributeNode('data-channel-mention');
- if (mentionAttribute) {
- e.preventDefault();
-
- searchForTerm(mentionAttribute.value);
- } else if (hashtagAttribute) {
+ if (hashtagAttribute) {
e.preventDefault();
searchForTerm(hashtagAttribute.value);
@@ -1339,6 +1326,15 @@ export function handleFormattedTextClick(e) {
}
}
+// This should eventually be removed once everywhere else calls the action
+function searchForTerm(term) {
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECEIVED_SEARCH_TERM,
+ term,
+ do_search: true
+ });
+}
+
export function isEmptyObject(object) {
if (!object) {
return true;