Fix edit channel (#1479)
This commit is contained in:
parent
6cbc71b718
commit
b465312cee
3 changed files with 15 additions and 5 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue