diff options
Diffstat (limited to 'webapp/components')
-rw-r--r-- | webapp/components/backstage/add_incoming_webhook.jsx | 27 | ||||
-rw-r--r-- | webapp/components/backstage/add_outgoing_webhook.jsx | 29 | ||||
-rw-r--r-- | webapp/components/backstage/installed_incoming_webhook.jsx | 16 | ||||
-rw-r--r-- | webapp/components/backstage/installed_outgoing_webhook.jsx | 18 | ||||
-rw-r--r-- | webapp/components/channel_header.jsx | 4 | ||||
-rw-r--r-- | webapp/components/more_channels.jsx | 4 | ||||
-rw-r--r-- | webapp/components/more_direct_channels.jsx | 4 | ||||
-rw-r--r-- | webapp/components/new_channel_flow.jsx | 60 | ||||
-rw-r--r-- | webapp/components/popover_list_members.jsx | 4 | ||||
-rw-r--r-- | webapp/components/removed_from_channel_modal.jsx | 9 | ||||
-rw-r--r-- | webapp/components/rename_channel_modal.jsx | 4 |
11 files changed, 114 insertions, 65 deletions
diff --git a/webapp/components/backstage/add_incoming_webhook.jsx b/webapp/components/backstage/add_incoming_webhook.jsx index 83027c6b3..f3601cb07 100644 --- a/webapp/components/backstage/add_incoming_webhook.jsx +++ b/webapp/components/backstage/add_incoming_webhook.jsx @@ -18,12 +18,12 @@ export default class AddIncomingWebhook extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); - this.updateName = this.updateName.bind(this); + this.updateDisplayName = this.updateDisplayName.bind(this); this.updateDescription = this.updateDescription.bind(this); this.updateChannelId = this.updateChannelId.bind(this); this.state = { - name: '', + displayName: '', description: '', channelId: '', saving: false, @@ -60,7 +60,9 @@ export default class AddIncomingWebhook extends React.Component { } const hook = { - channel_id: this.state.channelId + channel_id: this.state.channelId, + display_name: this.state.displayName, + description: this.state.description }; AsyncClient.addIncomingHook( @@ -70,15 +72,16 @@ export default class AddIncomingWebhook extends React.Component { }, (err) => { this.setState({ + saving: false, serverError: err.message }); } ); } - updateName(e) { + updateDisplayName(e) { this.setState({ - name: e.target.value + displayName: e.target.value }); } @@ -112,20 +115,21 @@ export default class AddIncomingWebhook extends React.Component { <div className='form-group'> <label className='control-label col-sm-3' - htmlFor='name' + htmlFor='displayName' > <FormattedMessage - id='add_incoming_webhook.name' - defaultMessage='Name' + id='add_incoming_webhook.displayName' + defaultMessage='Display Name' /> </label> <div className='col-md-5 col-sm-9'> <input - id='name' + id='displayName' type='text' + maxLength='64' className='form-control' - value={this.state.name} - onChange={this.updateName} + value={this.state.displayName} + onChange={this.updateDisplayName} /> </div> </div> @@ -143,6 +147,7 @@ export default class AddIncomingWebhook extends React.Component { <input id='description' type='text' + maxLength='128' className='form-control' value={this.state.description} onChange={this.updateDescription} diff --git a/webapp/components/backstage/add_outgoing_webhook.jsx b/webapp/components/backstage/add_outgoing_webhook.jsx index 5d98138df..ef57c6d05 100644 --- a/webapp/components/backstage/add_outgoing_webhook.jsx +++ b/webapp/components/backstage/add_outgoing_webhook.jsx @@ -18,14 +18,14 @@ export default class AddOutgoingWebhook extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); - this.updateName = this.updateName.bind(this); + this.updateDisplayName = this.updateDisplayName.bind(this); this.updateDescription = this.updateDescription.bind(this); this.updateChannelId = this.updateChannelId.bind(this); this.updateTriggerWords = this.updateTriggerWords.bind(this); this.updateCallbackUrls = this.updateCallbackUrls.bind(this); this.state = { - name: '', + displayName: '', description: '', channelId: '', triggerWords: '', @@ -80,7 +80,9 @@ export default class AddOutgoingWebhook extends React.Component { const hook = { channel_id: this.state.channelId, trigger_words: this.state.triggerWords.split('\n').map((word) => word.trim()), - callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim()) + callback_urls: this.state.callbackUrls.split('\n').map((url) => url.trim()), + display_name: this.state.displayName, + description: this.state.description }; AsyncClient.addOutgoingHook( @@ -90,15 +92,16 @@ export default class AddOutgoingWebhook extends React.Component { }, (err) => { this.setState({ + saving: false, serverError: err.message }); } ); } - updateName(e) { + updateDisplayName(e) { this.setState({ - name: e.target.value + displayName: e.target.value }); } @@ -144,20 +147,21 @@ export default class AddOutgoingWebhook extends React.Component { <div className='form-group'> <label className='control-label col-sm-3' - htmlFor='name' + htmlFor='displayName' > <FormattedMessage - id='add_outgoing_webhook.name' - defaultMessage='Name' + id='add_outgoing_webhook.displayName' + defaultMessage='Display Name' /> </label> <div className='col-md-5 col-sm-9'> <input - id='name' + id='displayName' type='text' + maxLength='64' className='form-control' - value={this.state.name} - onChange={this.updateName} + value={this.state.displayName} + onChange={this.updateDisplayName} /> </div> </div> @@ -175,6 +179,7 @@ export default class AddOutgoingWebhook extends React.Component { <input id='description' type='text' + maxLength='128' className='form-control' value={this.state.description} onChange={this.updateDescription} @@ -213,6 +218,7 @@ export default class AddOutgoingWebhook extends React.Component { <textarea id='triggerWords' rows='3' + maxLength='1000' className='form-control' value={this.state.triggerWords} onChange={this.updateTriggerWords} @@ -233,6 +239,7 @@ export default class AddOutgoingWebhook extends React.Component { <textarea id='callbackUrls' rows='3' + maxLength='1000' className='form-control' value={this.state.callbackUrls} onChange={this.updateCallbackUrls} diff --git a/webapp/components/backstage/installed_incoming_webhook.jsx b/webapp/components/backstage/installed_incoming_webhook.jsx index f65cf6327..95a303edc 100644 --- a/webapp/components/backstage/installed_incoming_webhook.jsx +++ b/webapp/components/backstage/installed_incoming_webhook.jsx @@ -39,7 +39,7 @@ export default class InstalledIncomingWebhook extends React.Component { <div className='item-details'> <div className='item-details__row'> <span className='item-details__name'> - {channelName} + {incomingWebhook.display_name || channelName} </span> <span className='item-details__type'> <FormattedMessage @@ -50,7 +50,19 @@ export default class InstalledIncomingWebhook extends React.Component { </div> <div className='item-details__row'> <span className='item-details__description'> - {Utils.getWindowLocationOrigin() + '/hooks/' + incomingWebhook.id} + {incomingWebhook.description} + </span> + </div> + <div className='tem-details__row'> + <span className='item-details__creation'> + <FormattedMessage + id='installed_integrations.creation' + defaultMessage='Created by {creator} on {createAt, date, full}' + values={{ + creator: Utils.displayUsername(incomingWebhook.user_id), + createAt: incomingWebhook.create_at + }} + /> </span> </div> </div> diff --git a/webapp/components/backstage/installed_outgoing_webhook.jsx b/webapp/components/backstage/installed_outgoing_webhook.jsx index fee427260..530474dc3 100644 --- a/webapp/components/backstage/installed_outgoing_webhook.jsx +++ b/webapp/components/backstage/installed_outgoing_webhook.jsx @@ -47,7 +47,7 @@ export default class InstalledOutgoingWebhook extends React.Component { <div className='item-details'> <div className='item-details__row'> <span className='item-details__name'> - {channelName} + {outgoingWebhook.display_name || channelName} </span> <span className='item-details__type'> <FormattedMessage @@ -58,9 +58,19 @@ export default class InstalledOutgoingWebhook extends React.Component { </div> <div className='item-details__row'> <span className='item-details__description'> - {Utils.getWindowLocationOrigin() + '/hooks/' + outgoingWebhook.id} - {' - '} - {outgoingWebhook.token} + {outgoingWebhook.description} + </span> + </div> + <div className='item-details__row'> + <span className='item-details__creation'> + <FormattedMessage + id='installed_integrations.creation' + defaultMessage='Created by {creator} on {createAt, date, full}' + values={{ + creator: Utils.displayUsername(outgoingWebhook.creator_id), + createAt: outgoingWebhook.create_at + }} + /> </span> </div> </div> diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx index 482aabc01..16d9ea536 100644 --- a/webapp/components/channel_header.jsx +++ b/webapp/components/channel_header.jsx @@ -26,10 +26,10 @@ import * as Utils from 'utils/utils.jsx'; import * as TextFormatting from 'utils/text_formatting.jsx'; import * as AsyncClient from 'utils/async_client.jsx'; import * as Client from 'utils/client.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; import Constants from 'utils/constants.jsx'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; const ActionTypes = Constants.ActionTypes; @@ -106,7 +106,7 @@ export default class ChannelHeader extends React.Component { }); const townsquare = ChannelStore.getByName('town-square'); - GlobalActions.emitChannelClickEvent(townsquare); + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + townsquare.name); }, (err) => { AsyncClient.dispatchError(err, 'handleLeave'); diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx index 811bb8101..5ccf9c11e 100644 --- a/webapp/components/more_channels.jsx +++ b/webapp/components/more_channels.jsx @@ -9,9 +9,9 @@ import * as AsyncClient from 'utils/async_client.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import LoadingScreen from './loading_screen.jsx'; import NewChannelFlow from './new_channel_flow.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; import loadingGif from 'images/load.gif'; @@ -65,7 +65,7 @@ export default class MoreChannels extends React.Component { client.joinChannel(channel.id, () => { $(ReactDOM.findDOMNode(this.refs.modal)).modal('hide'); - GlobalActions.emitChannelClickEvent(channel); + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name); this.setState({joiningChannel: -1}); }, (err) => { diff --git a/webapp/components/more_direct_channels.jsx b/webapp/components/more_direct_channels.jsx index 29d64517e..a83816c40 100644 --- a/webapp/components/more_direct_channels.jsx +++ b/webapp/components/more_direct_channels.jsx @@ -5,9 +5,9 @@ import {Modal} from 'react-bootstrap'; import FilteredUserList from './filtered_user_list.jsx'; import UserStore from 'stores/user_store.jsx'; import * as Utils from 'utils/utils.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; import SpinnerButton from 'components/spinner_button.jsx'; import React from 'react'; @@ -69,7 +69,7 @@ export default class MoreDirectChannels extends React.Component { Utils.openDirectChannelToUser( teammate, (channel) => { - GlobalActions.emitChannelClickEvent(channel); + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name); this.setState({loadingDMChannel: -1}); this.handleHide(); }, diff --git a/webapp/components/new_channel_flow.jsx b/webapp/components/new_channel_flow.jsx index 8c66ef3ce..82494dac0 100644 --- a/webapp/components/new_channel_flow.jsx +++ b/webapp/components/new_channel_flow.jsx @@ -4,25 +4,21 @@ import * as Utils from 'utils/utils.jsx'; import * as Client from 'utils/client.jsx'; import UserStore from 'stores/user_store.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; import NewChannelModal from './new_channel_modal.jsx'; import ChangeURLModal from './change_url_modal.jsx'; import {intlShape, injectIntl, defineMessages} from 'react-intl'; +import {browserHistory} from 'react-router'; + +import AppDispatcher from '../dispatcher/app_dispatcher.jsx'; +import Constants from 'utils/constants.jsx'; +const ActionTypes = Constants.ActionTypes; const SHOW_NEW_CHANNEL = 1; const SHOW_EDIT_URL = 2; const SHOW_EDIT_URL_THEN_COMPLETE = 3; const messages = defineMessages({ - invalidName: { - id: 'channel_flow.invalidName', - defaultMessage: 'Invalid Channel Name' - }, - alreadyExist: { - id: 'channel_flow.alreadyExist', - defaultMessage: 'A channel with that URL already exists' - }, channel: { id: 'channel_flow.channel', defaultMessage: 'Channel' @@ -87,37 +83,51 @@ class NewChannelFlow extends React.Component { } } doSubmit() { - var channel = {}; - - const {formatMessage} = this.props.intl; - channel.display_name = this.state.channelDisplayName; - if (!channel.display_name) { - this.setState({serverError: formatMessage(messages.invalidName)}); + if (!this.state.channelDisplayName) { + this.setState({serverError: Utils.localizeMessage('channel_flow.invalidName', 'Invalid Channel Name')}); return; } - channel.name = this.state.channelName; - if (channel.name.length < 2) { + if (this.state.channelName < 2) { this.setState({flowState: SHOW_EDIT_URL_THEN_COMPLETE}); return; } const cu = UserStore.getCurrentUser(); - channel.team_id = cu.team_id; - channel.purpose = this.state.channelPurpose; - channel.type = this.state.channelType; - - Client.createChannel(channel, + const channel = { + team_id: cu.team_id, + name: this.state.channelName, + display_name: this.state.channelDisplayName, + purpose: this.state.channelPurpose, + type: this.state.channelType + }; + Client.createChannel( + channel, (data) => { - this.props.onModalDismissed(); - GlobalActions.emitChannelClickEvent(data); + Client.getChannel( + data.id, + (data2, textStatus, xhr) => { + if (xhr.status === 304 || !data2) { + return; + } + + AppDispatcher.handleServerAction({ + type: ActionTypes.RECEIVED_CHANNEL, + channel: data2.channel, + member: data2.member + }); + + this.props.onModalDismissed(); + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + data2.channel.name); + } + ); }, (err) => { if (err.id === 'model.channel.is_valid.2_or_more.app_error') { this.setState({flowState: SHOW_EDIT_URL_THEN_COMPLETE}); } if (err.id === 'store.sql_channel.update.exists.app_error') { - this.setState({serverError: formatMessage(messages.alreadyExist)}); + this.setState({serverError: Utils.localizeMessage('channel_flow.alreadyExist', 'A channel with that URL already exists')}); return; } this.setState({serverError: err.message}); diff --git a/webapp/components/popover_list_members.jsx b/webapp/components/popover_list_members.jsx index 226a1889c..8c3c381af 100644 --- a/webapp/components/popover_list_members.jsx +++ b/webapp/components/popover_list_members.jsx @@ -6,10 +6,10 @@ import $ from 'jquery'; import UserStore from 'stores/user_store.jsx'; import {Popover, Overlay} from 'react-bootstrap'; import * as Utils from 'utils/utils.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; import Constants from 'utils/constants.jsx'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; import React from 'react'; @@ -35,7 +35,7 @@ export default class PopoverListMembers extends React.Component { Utils.openDirectChannelToUser( teammate, (channel, channelAlreadyExisted) => { - GlobalActions.emitChannelClickEvent(channel); + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + channel.name); if (channelAlreadyExisted) { this.closePopover(); } diff --git a/webapp/components/removed_from_channel_modal.jsx b/webapp/components/removed_from_channel_modal.jsx index 45018ac99..d037c089d 100644 --- a/webapp/components/removed_from_channel_modal.jsx +++ b/webapp/components/removed_from_channel_modal.jsx @@ -6,9 +6,10 @@ import ReactDOM from 'react-dom'; import ChannelStore from 'stores/channel_store.jsx'; import UserStore from 'stores/user_store.jsx'; import BrowserStore from 'stores/browser_store.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; +import * as Utils from 'utils/utils.jsx'; import {FormattedMessage} from 'react-intl'; +import {browserHistory} from 'react-router'; import React from 'react'; @@ -33,7 +34,11 @@ export default class RemovedFromChannelModal extends React.Component { } var townSquare = ChannelStore.getByName('town-square'); - setTimeout(() => GlobalActions.emitChannelClickEvent(townSquare), 1); + setTimeout( + () => { + browserHistory.push(Utils.getTeamURLNoOriginFromAddressBar() + '/channels/' + townSquare.name); + }, + 1); this.setState(newState); } diff --git a/webapp/components/rename_channel_modal.jsx b/webapp/components/rename_channel_modal.jsx index ced3c2d2b..3e47847e7 100644 --- a/webapp/components/rename_channel_modal.jsx +++ b/webapp/components/rename_channel_modal.jsx @@ -4,7 +4,7 @@ import ReactDOM from 'react-dom'; import * as Utils from 'utils/utils.jsx'; import * as Client from 'utils/client.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; +import * as AsyncClient from 'utils/async_client.jsx'; import Constants from 'utils/constants.jsx'; import {intlShape, injectIntl, defineMessages, FormattedMessage} from 'react-intl'; @@ -165,7 +165,7 @@ export default class RenameChannelModal extends React.Component { Client.updateChannel( channel, () => { - GlobalActions.emitChannelClickEvent(channel); + AsyncClient.getChannel(channel.id); this.handleHide(); }, |