From 5f7ab2bf1513aa9483814908c614a260d6dc56bb Mon Sep 17 00:00:00 2001 From: Martin Kraft Date: Mon, 13 May 2019 17:14:47 -0400 Subject: [PATCH] MM-15528: Updates to channel info for group-constrained channels. (#2786) * MM-15528: Adds new group-managed text to channel info header. * MM-15528: Hides 'Add Members' link if group-constrained. * MM-15528: Sets member list to view-only if channel is group-constrained. * Update app/screens/channel_members/index.js Co-Authored-By: Harrison Healey --- app/screens/channel_info/channel_info.js | 4 +++- app/screens/channel_info/channel_info_header.js | 10 ++++++++++ app/screens/channel_info/index.js | 5 ++++- app/screens/channel_members/index.js | 14 ++++++++------ assets/base/i18n/en.json | 5 +++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/app/screens/channel_info/channel_info.js b/app/screens/channel_info/channel_info.js index ed90a3226..d2e892cc8 100644 --- a/app/screens/channel_info/channel_info.js +++ b/app/screens/channel_info/channel_info.js @@ -392,6 +392,7 @@ export default class ChannelInfo extends PureComponent { canManageUsers, canEditChannel, theme, + currentChannel, } = this.props; if (channelIsArchived) { @@ -474,7 +475,7 @@ export default class ChannelInfo extends PureComponent { /> } - {canManageUsers && + {canManageUsers && !currentChannel.group_constrained && } diff --git a/app/screens/channel_info/channel_info_header.js b/app/screens/channel_info/channel_info_header.js index 00b1b86b3..0f10ef56e 100644 --- a/app/screens/channel_info/channel_info_header.js +++ b/app/screens/channel_info/channel_info_header.js @@ -31,6 +31,7 @@ export default class ChannelInfoHeader extends React.PureComponent { type: PropTypes.string.isRequired, isArchived: PropTypes.bool.isRequired, isBot: PropTypes.bool.isRequired, + isGroupConstrained: PropTypes.bool, }; render() { @@ -48,6 +49,7 @@ export default class ChannelInfoHeader extends React.PureComponent { type, isArchived, isBot, + isGroupConstrained, } = this.props; const style = getStyleSheet(theme); @@ -112,6 +114,14 @@ export default class ChannelInfoHeader extends React.PureComponent { /> } + {isGroupConstrained && + + + + } {creator && -1; const roles = getCurrentUserRoles(state); - const canManageUsers = currentChannel.hasOwnProperty('id') ? canManageChannelMembers(state) : false; + let canManageUsers = currentChannel.hasOwnProperty('id') ? canManageChannelMembers(state) : false; + if (currentChannel.group_constrained) { + canManageUsers = false; + } const currentUser = getUser(state, currentUserId); let status; diff --git a/app/screens/channel_members/index.js b/app/screens/channel_members/index.js index f563f41fd..b37975c3f 100644 --- a/app/screens/channel_members/index.js +++ b/app/screens/channel_members/index.js @@ -6,7 +6,7 @@ import {connect} from 'react-redux'; import {handleRemoveChannelMembers} from 'app/actions/views/channel_members'; import {getTheme} from 'mattermost-redux/selectors/entities/preferences'; -import {getCurrentChannelId, canManageChannelMembers} from 'mattermost-redux/selectors/entities/channels'; +import {getCurrentChannel, canManageChannelMembers} from 'mattermost-redux/selectors/entities/channels'; import {makeGetProfilesInChannel} from 'mattermost-redux/selectors/entities/users'; import {getProfilesInChannel, searchProfiles} from 'mattermost-redux/actions/users'; @@ -16,15 +16,17 @@ function makeMapStateToProps() { const getChannelMembers = makeGetProfilesInChannel(); return (state) => { - const currentChannelId = getCurrentChannelId(state); + const currentChannel = getCurrentChannel(state); let currentChannelMembers = []; - if (currentChannelId) { - currentChannelMembers = getChannelMembers(state, currentChannelId, true); + if (currentChannel.id) { + currentChannelMembers = getChannelMembers(state, currentChannel.id, true); } + const canManageUsers = canManageChannelMembers(state) && !currentChannel.group_constrained; + return { - canManageUsers: canManageChannelMembers(state), - currentChannelId, + canManageUsers, + currentChannelId: currentChannel.id, currentChannelMembers, currentUserId: state.entities.users.currentUserId, theme: getTheme(state), diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index 855eacd1b..48988385b 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -251,8 +251,8 @@ "mobile.file_upload.camera_video": "Take Video", "mobile.file_upload.library": "Photo Library", "mobile.file_upload.max_warning": "Uploads limited to 5 files maximum.", - "mobile.file_upload.video": "Video Library", "mobile.file_upload.unsupportedMimeType": "Only files of the following MIME type can be uploaded:\n{mimeTypes}", + "mobile.file_upload.video": "Video Library", "mobile.flagged_posts.empty_description": "Flags are a way to mark messages for follow up. Your flags are personal, and cannot be seen by other users.", "mobile.flagged_posts.empty_title": "No Flagged Posts", "mobile.help.title": "Help", @@ -382,6 +382,7 @@ "mobile.routes.channelInfo.createdBy": "Created by {creator} on ", "mobile.routes.channelInfo.delete_channel": "Archive Channel", "mobile.routes.channelInfo.favorite": "Favorite", + "mobile.routes.channelInfo.groupManaged": "Members are managed by linked groups", "mobile.routes.code": "{language} Code", "mobile.routes.code.noLanguage": "Code", "mobile.routes.edit_profile": "Edit Profile", @@ -554,4 +555,4 @@ "user.settings.push_notification.offline": "Offline", "user.settings.push_notification.online": "Online, away or offline", "web.root.signup_info": "All team communication in one place, searchable and accessible anywhere" -} +} \ No newline at end of file