Move instances of Client.updateChannelPurpose() in components to an action (#5096)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
24553164b6
Коммит
61b7226533
@@ -364,6 +364,25 @@ export function createChannel(channel, success, error) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function updateChannelPurpose(channelId, purposeValue, success, error) {
|
||||||
|
Client.updateChannelPurpose(
|
||||||
|
channelId,
|
||||||
|
purposeValue,
|
||||||
|
() => {
|
||||||
|
AsyncClient.getChannel(channelId);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
success();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function updateChannelHeader(channelId, header, success, error) {
|
export function updateChannelHeader(channelId, header, success, error) {
|
||||||
Client.updateChannelHeader(
|
Client.updateChannelHeader(
|
||||||
channelId,
|
channelId,
|
||||||
|
|||||||
@@ -2,15 +2,14 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import PreferenceStore from 'stores/preference_store.jsx';
|
import PreferenceStore from 'stores/preference_store.jsx';
|
||||||
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
|
|
||||||
import * as AsyncClient from 'utils/async_client.jsx';
|
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import Constants from 'utils/constants.jsx';
|
import Constants from 'utils/constants.jsx';
|
||||||
import * as Utils from 'utils/utils.jsx';
|
import * as Utils from 'utils/utils.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Modal} from 'react-bootstrap';
|
import {Modal} from 'react-bootstrap';
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
|
import {updateChannelPurpose} from 'actions/channel_actions.jsx';
|
||||||
|
|
||||||
export default class EditChannelPurposeModal extends React.Component {
|
export default class EditChannelPurposeModal extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -64,18 +63,11 @@ export default class EditChannelPurposeModal extends React.Component {
|
|||||||
|
|
||||||
this.setState({submitted: true});
|
this.setState({submitted: true});
|
||||||
|
|
||||||
Client.updateChannelPurpose(
|
updateChannelPurpose(
|
||||||
this.props.channel.id,
|
this.props.channel.id,
|
||||||
this.refs.purpose.value.trim(),
|
this.refs.purpose.value.trim(),
|
||||||
(channel) => {
|
() => {
|
||||||
AsyncClient.getChannel(this.props.channel.id);
|
|
||||||
|
|
||||||
this.handleHide();
|
this.handleHide();
|
||||||
|
|
||||||
AppDispatcher.handleServerAction({
|
|
||||||
type: Constants.ActionTypes.RECEIVED_CHANNEL,
|
|
||||||
channel
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err.id === 'api.context.invalid_param.app_error') {
|
if (err.id === 'api.context.invalid_param.app_error') {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user