PLT-6815 Do not disconnect websocket when joining a team (#6746)
* Do not disconnect websocket when joining a team * Fix eslint error
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
072da672a8
Коммит
82b36b3721
@@ -18,7 +18,6 @@ import {viewChannel} from 'mattermost-redux/actions/channels';
|
||||
import * as TeamActions from 'mattermost-redux/actions/teams';
|
||||
|
||||
import {TeamTypes} from 'mattermost-redux/action_types';
|
||||
import {batchActions} from 'redux-batched-actions';
|
||||
|
||||
export function checkIfTeamExists(teamName, onSuccess, onError) {
|
||||
TeamActions.checkIfTeamExists(teamName)(dispatch, getState).then(
|
||||
@@ -92,30 +91,24 @@ export function updateTeamMemberRoles(teamId, userId, newRoles, success, error)
|
||||
|
||||
export function addUserToTeamFromInvite(data, hash, inviteId, success, error) {
|
||||
Client4.addToTeamFromInvite(hash, data, inviteId).then(
|
||||
(team) => {
|
||||
const member = {
|
||||
team_id: team.id,
|
||||
user_id: getState().entities.users.currentUserId,
|
||||
roles: 'team_user',
|
||||
delete_at: 0,
|
||||
msg_count: 0,
|
||||
mention_count: 0
|
||||
};
|
||||
(member) => {
|
||||
TeamActions.getTeam(member.team_id)(dispatch, getState).then(
|
||||
(team) => {
|
||||
dispatch({
|
||||
type: TeamTypes.RECEIVED_MY_TEAM_MEMBER,
|
||||
data: {
|
||||
...member,
|
||||
delete_at: 0,
|
||||
msg_count: 0,
|
||||
mention_count: 0
|
||||
}
|
||||
});
|
||||
|
||||
dispatch(batchActions([
|
||||
{
|
||||
type: TeamTypes.RECEIVED_TEAMS_LIST,
|
||||
data: [team]
|
||||
},
|
||||
{
|
||||
type: TeamTypes.RECEIVED_MY_TEAM_MEMBER,
|
||||
data: member
|
||||
if (success) {
|
||||
success(team);
|
||||
}
|
||||
}
|
||||
]));
|
||||
|
||||
if (success) {
|
||||
success(team);
|
||||
}
|
||||
);
|
||||
},
|
||||
).catch(
|
||||
(err) => {
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
||||
// See License.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
|
||||
|
||||
import {Link} from 'react-router/es6';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import {Link, browserHistory} from 'react-router/es6';
|
||||
import {Tooltip, OverlayTrigger} from 'react-bootstrap';
|
||||
import {Constants} from 'utils/constants.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
export default class SelectTeamItem extends React.Component {
|
||||
export default class SelectTeamItem extends React.PureComponent {
|
||||
static propTypes = {
|
||||
team: PropTypes.object.isRequired,
|
||||
url: PropTypes.string.isRequired,
|
||||
onTeamClick: PropTypes.func.isRequired,
|
||||
loading: PropTypes.bool.isRequired
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.handleTeamClick = this.handleTeamClick.bind(this);
|
||||
}
|
||||
|
||||
handleTeamClick() {
|
||||
handleTeamClick = () => {
|
||||
addUserToTeamFromInvite('', '', this.props.team.invite_id,
|
||||
() => {
|
||||
browserHistory.push(`/${this.props.team.name}/channels/town-square`);
|
||||
}
|
||||
);
|
||||
this.props.onTeamClick(this.props.team);
|
||||
}
|
||||
|
||||
@@ -71,7 +69,6 @@ export default class SelectTeamItem extends React.Component {
|
||||
{showDescriptionTooltip}
|
||||
<Link
|
||||
id={Utils.createSafeId(this.props.team.display_name)}
|
||||
to={this.props.url}
|
||||
onClick={this.handleTeamClick}
|
||||
>
|
||||
<span className='signup-team-dir__name'>{this.props.team.display_name}</span>
|
||||
|
||||
@@ -84,7 +84,6 @@ export default class SelectTeam extends React.Component {
|
||||
<SelectTeamItem
|
||||
key={'team_' + openTeam.name}
|
||||
team={openTeam}
|
||||
url={`/signup_user_complete/?id=${openTeam.invite_id}`}
|
||||
onTeamClick={this.handleTeamClick}
|
||||
loading={this.state.loadingTeamId === openTeam.id}
|
||||
/>
|
||||
|
||||
Ссылка в новой задаче
Block a user