Move instances of Client.addUserToTeamFromInvite() in components to an action (#5132)
Этот коммит содержится в:
коммит произвёл
enahum
родитель
d3a285e64d
Коммит
48e1fa8aa0
@@ -92,3 +92,21 @@ export function updateTeamMemberRoles(teamId, userId, newRoles, success, error)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function addUserToTeamFromInvite(data, hash, inviteId, success, error) {
|
||||
Client.addUserToTeamFromInvite(
|
||||
data,
|
||||
hash,
|
||||
inviteId,
|
||||
(team) => {
|
||||
if (success) {
|
||||
success(team);
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
if (error) {
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import ErrorBar from 'components/error_bar.jsx';
|
||||
import FormError from 'components/form_error.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
|
||||
import BrowserStore from 'stores/browser_store.jsx';
|
||||
import UserStore from 'stores/user_store.jsx';
|
||||
|
||||
@@ -146,12 +147,14 @@ export default class LoginController extends React.Component {
|
||||
token,
|
||||
() => {
|
||||
// check for query params brought over from signup_user_complete
|
||||
const query = this.props.location.query;
|
||||
if (query.id || query.h) {
|
||||
Client.addUserToTeamFromInvite(
|
||||
query.d,
|
||||
query.h,
|
||||
query.id,
|
||||
const hash = this.props.location.query.h;
|
||||
const data = this.props.location.query.d;
|
||||
const inviteId = this.props.location.query.id;
|
||||
if (inviteId || hash) {
|
||||
addUserToTeamFromInvite(
|
||||
data,
|
||||
hash,
|
||||
inviteId,
|
||||
(team) => {
|
||||
this.finishSignin(team);
|
||||
},
|
||||
|
||||
@@ -5,6 +5,7 @@ import FormError from 'components/form_error.jsx';
|
||||
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import {track} from 'actions/analytics_actions.jsx';
|
||||
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
@@ -69,11 +70,15 @@ export default class SignupLdap extends React.Component {
|
||||
}
|
||||
|
||||
handleLdapSignupSuccess() {
|
||||
if (this.props.location.query.id || this.props.location.query.h) {
|
||||
Client.addUserToTeamFromInvite(
|
||||
this.props.location.query.d,
|
||||
this.props.location.query.h,
|
||||
this.props.location.query.id,
|
||||
const hash = this.props.location.query.h;
|
||||
const data = this.props.location.query.d;
|
||||
const inviteId = this.props.location.query.id;
|
||||
|
||||
if (inviteId || hash) {
|
||||
addUserToTeamFromInvite(
|
||||
data,
|
||||
hash,
|
||||
inviteId,
|
||||
() => {
|
||||
this.finishSignup();
|
||||
},
|
||||
|
||||
@@ -12,6 +12,7 @@ import BrowserStore from 'stores/browser_store.jsx';
|
||||
import * as AsyncClient from 'utils/async_client.jsx';
|
||||
import Client from 'client/web_client.jsx';
|
||||
import * as GlobalActions from 'actions/global_actions.jsx';
|
||||
import {addUserToTeamFromInvite} from 'actions/team_actions.jsx';
|
||||
|
||||
import logoImage from 'images/logo.png';
|
||||
import ErrorBar from 'components/error_bar.jsx';
|
||||
@@ -68,7 +69,7 @@ export default class SignupController extends React.Component {
|
||||
const userLoggedIn = UserStore.getCurrentUser() != null;
|
||||
|
||||
if ((inviteId || hash) && userLoggedIn) {
|
||||
Client.addUserToTeamFromInvite(
|
||||
addUserToTeamFromInvite(
|
||||
data,
|
||||
hash,
|
||||
inviteId,
|
||||
|
||||
Ссылка в новой задаче
Block a user