Disabled the invite email portion of the team setup when email is disabled on the server

Этот коммит содержится в:
hmhealey
2015-08-11 15:47:48 -04:00
родитель 3f5993eedf
Коммит e27ba7454d

Просмотреть файл

@@ -428,23 +428,27 @@ SendInivtesPage = React.createClass({
e.preventDefault(); e.preventDefault();
var valid = true; var valid = true;
var emails = [];
for (var i = 0; i < this.props.state.invites.length; i++) { if (this.state.emailEnabled) {
if (!this.refs['email_' + i].validate(this.props.state.team.email)) { var emails = [];
valid = false;
} else { for (var i = 0; i < this.props.state.invites.length; i++) {
emails.push(this.refs['email_' + i].getValue()); if (!this.refs['email_' + i].validate(this.props.state.team.email)) {
valid = false;
} else {
emails.push(this.refs['email_' + i].getValue());
}
}
if (valid) {
this.props.state.invites = emails;
} }
} }
if (!valid) { if (valid) {
return; this.props.state.wizard = "username";
this.props.updateParent(this.props.state);
} }
this.props.state.wizard = "username";
this.props.state.invites = emails;
this.props.updateParent(this.props.state);
}, },
submitAddInvite: function (e) { submitAddInvite: function (e) {
e.preventDefault(); e.preventDefault();
@@ -461,22 +465,43 @@ SendInivtesPage = React.createClass({
this.props.updateParent(this.props.state); this.props.updateParent(this.props.state);
}, },
getInitialState: function() { getInitialState: function() {
return { }; return {
emailEnabled: client.isEmailEnabledSynchronous()
};
}, },
render: function() { render: function() {
client.track('signup', 'signup_team_05_send_invites'); client.track('signup', 'signup_team_05_send_invites');
var name_error = this.state.name_error ? <label className="control-label">{ this.state.name_error }</label> : null; var name_error = this.state.name_error ? <label className="control-label">{ this.state.name_error }</label> : null;
var emails = []; var content = null;
var bottomContent = null;
for (var i = 0; i < this.props.state.invites.length; i++) { if (this.state.emailEnabled) {
if (i == 0) { var emails = [];
emails.push(<EmailItem focus={true} key={i} ref={'email_' + i} email={this.props.state.invites[i]} />);
} else { for (var i = 0; i < this.props.state.invites.length; i++) {
emails.push(<EmailItem focus={false} key={i} ref={'email_' + i} email={this.props.state.invites[i]} />); if (i == 0) {
emails.push(<EmailItem focus={true} key={i} ref={'email_' + i} email={this.props.state.invites[i]} />);
} else {
emails.push(<EmailItem focus={false} key={i} ref={'email_' + i} email={this.props.state.invites[i]} />);
}
} }
content = (
<div>
{emails}
<div className="form-group text-right"><a href="#" onClick={this.submitAddInvite}>Add Invitation</a></div>
</div>
);
bottomContent = (
<p className="color--light">{"if you prefer, you can invite " + strings.Team + " members later"}<br /> and <a href="#" onClick={this.submitSkip}>skip this step</a> for now.</p>
);
} else {
content = (
<div className='form-group color--light'>Email is currently disabled for your team, and emails cannot be sent. Contact your system administrator to enable email and email invitations.</div>
);
} }
return ( return (
@@ -484,11 +509,10 @@ SendInivtesPage = React.createClass({
<form> <form>
<img className="signup-team-logo" src="/static/images/logo.png" /> <img className="signup-team-logo" src="/static/images/logo.png" />
<h2>{"Invite " + utils.toTitleCase(strings.Team) + " Members"}</h2> <h2>{"Invite " + utils.toTitleCase(strings.Team) + " Members"}</h2>
{ emails } {content}
<div className="form-group text-right"><a href="#" onClick={this.submitAddInvite}>Add Invitation</a></div>
<div className="form-group"><button type="submit" className="btn-primary btn" onClick={this.submitNext}>Next<i className="glyphicon glyphicon-chevron-right"></i></button></div> <div className="form-group"><button type="submit" className="btn-primary btn" onClick={this.submitNext}>Next<i className="glyphicon glyphicon-chevron-right"></i></button></div>
</form> </form>
<p className="color--light">{"if you prefer, you can invite " + strings.Team + " members later"}<br /> and <a href="#" onClick={this.submitSkip}>skip this step</a> for now.</p> {bottomContent}
<div className="margin--extra"> <div className="margin--extra">
<a href="#" onClick={this.submitBack}>Back to previous step</a> <a href="#" onClick={this.submitBack}>Back to previous step</a>
</div> </div>