First commit for toggling mentions using shortcut and button (#4169)

Also did some refactoring and moved code to actions

Fixed coding style errors
Этот коммит содержится в:
Pepijn
2016-10-11 15:07:38 +02:00
коммит произвёл Joram Wilander
родитель 6e9e41ebb5
Коммит 944bb1ba61
6 изменённых файлов: 82 добавлений и 73 удалений

Просмотреть файл

@@ -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() {