From 68ea0abfa665144164041c9421899bfc21412f8a Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 20 Jun 2017 15:22:46 -0400 Subject: 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 --- webapp/utils/utils.jsx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'webapp/utils/utils.jsx') 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; -- cgit v1.2.3-1-g7c22