diff options
author | Pepijn <pepijnfens@gmail.com> | 2016-10-11 15:07:38 +0200 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-10-11 09:07:38 -0400 |
commit | 944bb1ba615ef5205f33191a4542f36002a4db23 (patch) | |
tree | 8a95e4081e050298491c46520fa45eaa70ee5ec7 /webapp/components/sidebar_right_menu.jsx | |
parent | 6e9e41ebb500e0d343374421719f24c515958808 (diff) | |
download | chat-944bb1ba615ef5205f33191a4542f36002a4db23.tar.gz chat-944bb1ba615ef5205f33191a4542f36002a4db23.tar.bz2 chat-944bb1ba615ef5205f33191a4542f36002a4db23.zip |
First commit for toggling mentions using shortcut and button (#4169)
Also did some refactoring and moved code to actions
Fixed coding style errors
Diffstat (limited to 'webapp/components/sidebar_right_menu.jsx')
-rw-r--r-- | webapp/components/sidebar_right_menu.jsx | 30 |
1 files changed, 6 insertions, 24 deletions
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() { |