Files
mattermost/webapp/stores/modal_store.jsx
Joram Wilander 3a91d4e5e4 PLT-3077 Add group messaging (#5489)
* Implement server changes for group messaging

* Majority of client-side implementation

* Some server updates

* Added new React multiselect component

* Fix style issues

* Add custom renderer for options

* Fix model test

* Update ENTER functionality for multiselect control

* Remove buttons from multiselect UI control

* Updating group messaging UI (#5524)

* Move filter controls up a component level

* Scroll with arrow keys

* Updating mobile layout for multiselect (#5534)

* Fix race condition when backspacing quickly

* Hidden or new GMs show up for regular messages

* Add overriding of number remaining text

* Add UI filtering for team if config setting set

* Add icon to channel switcher and class prop to status icon

* Minor updates per feedback

* Improving group messaging UI (#5563)

* UX changes per feedback

* Update email for group messages

* UI fixes for group messaging (#5587)

* Fix missing localization string

* Add maximum users message when adding members to GM

* Fix input clearing on Android

* Updating group messaging UI (#5603)

* Updating UI for group messaging (#5604)
2017-03-02 17:48:56 -05:00

50 lines
1.6 KiB
JavaScript

// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import EventEmitter from 'events';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
class ModalStoreClass extends EventEmitter {
constructor() {
super();
this.addModalListener = this.addModalListener.bind(this);
this.removeModalListener = this.removeModalListener.bind(this);
this.handleEventPayload = this.handleEventPayload.bind(this);
this.dispatchToken = AppDispatcher.register(this.handleEventPayload);
}
addModalListener(action, callback) {
this.on(action, callback);
}
removeModalListener(action, callback) {
this.removeListener(action, callback);
}
handleEventPayload(payload) {
// toggle event handlers should accept a boolean show/hide value and can accept a map of arguments
const {type, value, ...args} = payload.action; //eslint-disable-line no-use-before-define
switch (type) {
case ActionTypes.TOGGLE_IMPORT_THEME_MODAL:
case ActionTypes.TOGGLE_INVITE_MEMBER_MODAL:
case ActionTypes.TOGGLE_LEAVE_TEAM_MODAL:
case ActionTypes.TOGGLE_DELETE_POST_MODAL:
case ActionTypes.TOGGLE_GET_POST_LINK_MODAL:
case ActionTypes.TOGGLE_GET_TEAM_INVITE_LINK_MODAL:
case ActionTypes.TOGGLE_GET_PUBLIC_LINK_MODAL:
case ActionTypes.TOGGLE_DM_MODAL:
this.emit(type, value, args);
break;
}
}
}
const ModalStore = new ModalStoreClass();
export default ModalStore;