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 <harrisonmhealey@gmail.com>
This commit is contained in:
Martin Kraft 2019-05-13 17:14:47 -04:00 committed by Harrison Healey
parent f36ee37402
commit 5f7ab2bf15
5 changed files with 28 additions and 10 deletions

View file

@ -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 {
/>
</React.Fragment>
}
{canManageUsers &&
{canManageUsers && !currentChannel.group_constrained &&
<React.Fragment>
<View style={style.separator}/>
<ChannelInfoRow
@ -551,6 +552,7 @@ export default class ChannelInfo extends PureComponent {
type={currentChannel.type}
isArchived={currentChannel.delete_at !== 0}
isBot={isBot}
isGroupConstrained={currentChannel.group_constrained}
/>
}
<View style={style.rowsContainer}>

View file

@ -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 {
/>
</View>
}
{isGroupConstrained &&
<Text style={style.createdBy}>
<FormattedText
id='mobile.routes.channelInfo.groupManaged'
defaultMessage='Members are managed by linked groups'
/>
</Text>
}
{creator &&
<Text style={style.createdBy}>
<FormattedText

View file

@ -56,7 +56,10 @@ function mapStateToProps(state) {
const isCurrent = currentChannel.id === state.entities.channels.currentChannelId;
const isFavorite = favoriteChannels && favoriteChannels.indexOf(currentChannel.id) > -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;

View file

@ -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),

View file

@ -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"
}
}