Fix edit channel (#1479)

This commit is contained in:
enahum 2018-03-05 15:12:28 +00:00 committed by Harrison Healey
parent 6cbc71b718
commit b465312cee
3 changed files with 15 additions and 5 deletions

View file

@ -213,7 +213,7 @@ export default class EditChannelInfo extends PureComponent {
let displayError;
if (error) {
displayError = (
<View style={[style.errorContainer, {deviceWidth}]}>
<View style={[style.errorContainer, {width: deviceWidth}]}>
<View style={style.errorWrapper}>
<ErrorText error={error}/>
</View>

View file

@ -50,6 +50,10 @@ const messages = {
export default class EditChannel extends PureComponent {
static propTypes = {
actions: PropTypes.shape({
patchChannel: PropTypes.func.isRequired,
setChannelDisplayName: PropTypes.func.isRequired,
}),
navigator: PropTypes.object.isRequired,
theme: PropTypes.object.isRequired,
deviceWidth: PropTypes.number.isRequired,
@ -58,9 +62,6 @@ export default class EditChannel extends PureComponent {
currentTeamUrl: PropTypes.string.isRequired,
updateChannelRequest: PropTypes.object.isRequired,
closeButton: PropTypes.object,
actions: PropTypes.shape({
patchChannel: PropTypes.func.isRequired,
}),
};
static contextTypes = {
@ -137,6 +138,13 @@ export default class EditChannel extends PureComponent {
}
close = () => {
const {channel: {type}} = this.props;
const isDirect = type === General.DM_CHANNEL || type === General.GM_CHANNEL;
if (!isDirect) {
this.props.actions.setChannelDisplayName(this.state.displayName);
}
this.props.navigator.pop({animated: true});
};

View file

@ -7,8 +7,9 @@ import {connect} from 'react-redux';
import {getCurrentChannel} from 'mattermost-redux/selectors/entities/channels';
import {getCurrentTeamUrl} from 'mattermost-redux/selectors/entities/teams';
import {patchChannel} from 'mattermost-redux/actions/channels';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {setChannelDisplayName} from 'app/actions/views/channel';
import {getDimensions} from 'app/selectors/device';
import EditChannel from './edit_channel';
@ -32,6 +33,7 @@ function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
patchChannel,
setChannelDisplayName,
}, dispatch),
};
}