diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-02 17:48:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-02 17:48:56 -0500 |
commit | 3a91d4e5e419a43ff19a0736ce697f8d611d36e3 (patch) | |
tree | e57ad85d49f8768a575f27c89d338a4ccaeda521 /webapp/components/channel_header.jsx | |
parent | 8c5cee9521656bcffb371aad9dae4bea8fc70e29 (diff) | |
download | chat-3a91d4e5e419a43ff19a0736ce697f8d611d36e3.tar.gz chat-3a91d4e5e419a43ff19a0736ce697f8d611d36e3.tar.bz2 chat-3a91d4e5e419a43ff19a0736ce697f8d611d36e3.zip |
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)
Diffstat (limited to 'webapp/components/channel_header.jsx')
-rw-r--r-- | webapp/components/channel_header.jsx | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx index 341c9be1b..9be2d5b58 100644 --- a/webapp/components/channel_header.jsx +++ b/webapp/components/channel_header.jsx @@ -32,7 +32,9 @@ import {getSiteURL} from 'utils/url.jsx'; import * as TextFormatting from 'utils/text_formatting.jsx'; import {getFlaggedPosts} from 'actions/post_actions.jsx'; -import {Constants, Preferences, UserStatuses} from 'utils/constants.jsx'; +import AppDispatcher from 'dispatcher/app_dispatcher.jsx'; + +import {Constants, Preferences, UserStatuses, ActionTypes} from 'utils/constants.jsx'; import React from 'react'; import {FormattedMessage} from 'react-intl'; @@ -53,6 +55,7 @@ export default class ChannelHeader extends React.Component { this.getFlagged = this.getFlagged.bind(this); this.initWebrtc = this.initWebrtc.bind(this); this.onBusy = this.onBusy.bind(this); + this.openDirectMessageModal = this.openDirectMessageModal.bind(this); const state = this.getStateFromStores(); state.showEditChannelPurposeModal = false; @@ -198,6 +201,14 @@ export default class ChannelHeader extends React.Component { this.setState({isBusy}); } + openDirectMessageModal() { + AppDispatcher.handleViewAction({ + type: ActionTypes.TOGGLE_DM_MODAL, + value: true, + startingUsers: UserStore.getProfileListInChannel(this.props.channelId, true) + }); + } + render() { const flagIcon = Constants.FLAG_ICON_SVG; @@ -246,7 +257,8 @@ export default class ChannelHeader extends React.Component { const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser(); const isSystemAdmin = UserStore.isSystemAdminForCurrentUser(); const isChannelAdmin = ChannelStore.isChannelAdminForCurrentChannel(); - const isDirect = (this.state.channel.type === 'D'); + const isDirect = (this.state.channel.type === Constants.DM_CHANNEL); + const isGroup = (this.state.channel.type === Constants.GM_CHANNEL); let webrtc; if (isDirect) { @@ -319,6 +331,10 @@ export default class ChannelHeader extends React.Component { } } + if (isGroup) { + channelTitle = ChannelUtils.buildGroupChannelName(channel.id); + } + let channelTerm = ( <FormattedMessage id='channel_header.channel' @@ -364,6 +380,64 @@ export default class ChannelHeader extends React.Component { </ToggleModalButton> </li> ); + } else if (isGroup) { + dropdownContents.push( + <li + key='edit_header_direct' + role='presentation' + > + <ToggleModalButton + role='menuitem' + dialogType={EditChannelHeaderModal} + dialogProps={{channel}} + > + <FormattedMessage + id='channel_header.channelHeader' + defaultMessage='Edit Channel Header' + /> + </ToggleModalButton> + </li> + ); + + dropdownContents.push( + <li + key='notification_preferences' + role='presentation' + > + <ToggleModalButton + role='menuitem' + dialogType={ChannelNotificationsModal} + dialogProps={{ + channel, + channelMember: this.state.memberChannel, + currentUser: this.state.currentUser + }} + > + <FormattedMessage + id='channel_header.notificationPreferences' + defaultMessage='Notification Preferences' + /> + </ToggleModalButton> + </li> + ); + + dropdownContents.push( + <li + key='add_members' + role='presentation' + > + <a + role='menuitem' + href='#' + onClick={this.openDirectMessageModal} + > + <FormattedMessage + id='channel_header.addMembers' + defaultMessage='Add Members' + /> + </a> + </li> + ); } else { dropdownContents.push( <li |