From 944bb1ba615ef5205f33191a4542f36002a4db23 Mon Sep 17 00:00:00 2001 From: Pepijn Date: Tue, 11 Oct 2016 15:07:38 +0200 Subject: First commit for toggling mentions using shortcut and button (#4169) Also did some refactoring and moved code to actions Fixed coding style errors --- webapp/components/sidebar_right_menu.jsx | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) (limited to 'webapp/components/sidebar_right_menu.jsx') diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx index 757a919c3..a11869cc2 100644 --- a/webapp/components/sidebar_right_menu.jsx +++ b/webapp/components/sidebar_right_menu.jsx @@ -9,6 +9,7 @@ import AboutBuildModal from './about_build_modal.jsx'; import UserStore from 'stores/user_store.jsx'; import TeamStore from 'stores/team_store.jsx'; +import SearchStore from 'stores/search_store.jsx'; import PreferenceStore from 'stores/preference_store.jsx'; import WebrtcStore from 'stores/webrtc_store.jsx'; @@ -92,32 +93,13 @@ export default class SidebarRightMenu extends React.Component { searchMentions(e) { e.preventDefault(); - const user = this.state.currentUser; - - let terms = ''; - if (user.notify_props && user.notify_props.mention_keys) { - const termKeys = UserStore.getMentionKeys(user.id); - - if (termKeys.indexOf('@channel') !== -1) { - termKeys[termKeys.indexOf('@channel')] = ''; - } - - if (termKeys.indexOf('@all') !== -1) { - termKeys[termKeys.indexOf('@all')] = ''; - } - - terms = termKeys.join(' '); + if (SearchStore.isMentionSearch) { + GlobalActions.toggleSideBarAction(false); + } else { + GlobalActions.emitSearchMentionsEvent(user); + this.hideSidebars(); } - - this.hideSidebars(); - - AppDispatcher.handleServerAction({ - type: ActionTypes.RECEIVED_SEARCH_TERM, - term: terms, - do_search: true, - is_mention_search: true - }); } closeLeftSidebar() { -- cgit v1.2.3-1-g7c22