PLT-3777 Channel URL name changes when display name is updated (#3795)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
fdd7962d42
Коммит
52aa1120c5
@@ -2,7 +2,6 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
import TeamStore from 'stores/team_store.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
@@ -11,7 +10,6 @@ import Constants from 'utils/constants.jsx';
|
||||
import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl';
|
||||
|
||||
import {Modal} from 'react-bootstrap';
|
||||
import {browserHistory} from 'react-router';
|
||||
|
||||
const holders = defineMessages({
|
||||
required: {
|
||||
@@ -57,7 +55,6 @@ export default class RenameChannelModal extends React.Component {
|
||||
|
||||
this.onNameChange = this.onNameChange.bind(this);
|
||||
this.onDisplayNameChange = this.onDisplayNameChange.bind(this);
|
||||
this.displayNameKeyUp = this.displayNameKeyUp.bind(this);
|
||||
|
||||
this.state = {
|
||||
displayName: props.channel.display_name,
|
||||
@@ -167,9 +164,7 @@ export default class RenameChannelModal extends React.Component {
|
||||
Client.updateChannel(
|
||||
channel,
|
||||
() => {
|
||||
const team = TeamStore.getCurrent().name;
|
||||
AsyncClient.getChannel(channel.id);
|
||||
browserHistory.replace(`/${team}/channels/${channel.name}`);
|
||||
this.handleHide();
|
||||
},
|
||||
(err) => {
|
||||
@@ -198,15 +193,6 @@ export default class RenameChannelModal extends React.Component {
|
||||
this.setState({displayName: ReactDOM.findDOMNode(this.refs.displayName).value});
|
||||
}
|
||||
|
||||
displayNameKeyUp() {
|
||||
if (this.state.channelName !== Constants.DEFAULT_CHANNEL) {
|
||||
const displayName = ReactDOM.findDOMNode(this.refs.displayName).value.trim();
|
||||
const channelName = Utils.cleanUpUrlable(displayName);
|
||||
ReactDOM.findDOMNode(this.refs.channelName).value = channelName;
|
||||
this.setState({channelName});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let displayNameError = null;
|
||||
let displayNameClass = 'form-group';
|
||||
@@ -260,7 +246,6 @@ export default class RenameChannelModal extends React.Component {
|
||||
/>
|
||||
</label>
|
||||
<input
|
||||
onKeyUp={this.displayNameKeyUp}
|
||||
onChange={this.onDisplayNameChange}
|
||||
type='text'
|
||||
ref='displayName'
|
||||
|
||||
Ссылка в новой задаче
Block a user