summaryrefslogtreecommitdiffstats
path: root/web/react/components/invite_member_modal.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-08-14 08:48:24 -0400
committerChristopher Speller <crspeller@gmail.com>2015-08-14 08:48:24 -0400
commit92c4df5b109ac8b15f6384a5c027024696bbd4d8 (patch)
tree41a18a9bcbbcc7cd961cc424878ac37aade5c288 /web/react/components/invite_member_modal.jsx
parenta8930cbabec21635a10e8cac4d2c0c79867f283d (diff)
parent8fc4456213c5ee16863b7f1bcb20e35a19469a1d (diff)
downloadchat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.tar.gz
chat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.tar.bz2
chat-92c4df5b109ac8b15f6384a5c027024696bbd4d8.zip
Merge pull request #370 from hmhealey/mm1812
MM-1812 Provide warnings on team invite screens when email is disabled
Diffstat (limited to 'web/react/components/invite_member_modal.jsx')
-rw-r--r--web/react/components/invite_member_modal.jsx66
1 files changed, 56 insertions, 10 deletions
diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx
index 75538c8fe..5b6924891 100644
--- a/web/react/components/invite_member_modal.jsx
+++ b/web/react/components/invite_member_modal.jsx
@@ -2,6 +2,7 @@
// See License.txt for license information.
var utils = require('../utils/utils.jsx');
+var ConfigStore = require('../stores/config_store.jsx');
var Client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx');
var ConfirmModal = require('./confirm_modal.jsx');
@@ -35,6 +36,10 @@ module.exports = React.createClass({
});
},
handleSubmit: function(e) {
+ if (!this.state.emailEnabled) {
+ return;
+ }
+
var inviteIds = this.state.inviteIds;
var count = inviteIds.length;
var invites = [];
@@ -147,12 +152,18 @@ module.exports = React.createClass({
idCount: 0,
emailErrors: {},
firstNameErrors: {},
- lastNameErrors: {}
+ lastNameErrors: {},
+ emailEnabled: !ConfigStore.getSettingAsBoolean('ByPassEmail', false)
};
},
render: function() {
var currentUser = UserStore.getCurrentUser();
+ var inputDisabled = '';
+ if (!this.state.emailEnabled) {
+ inputDisabled = 'disabled';
+ }
+
if (currentUser != null) {
var inviteSections = [];
var inviteIds = this.state.inviteIds;
@@ -195,13 +206,13 @@ module.exports = React.createClass({
nameFields = (<div className='row--invite'>
<div className='col-sm-6'>
<div className={firstNameClass}>
- <input type='text' className='form-control' ref={'first_name' + index} placeholder='First name' maxLength='64' />
+ <input type='text' className='form-control' ref={'first_name' + index} placeholder='First name' maxLength='64' disabled={!this.state.emailEnabled}/>
{firstNameError}
</div>
</div>
<div className='col-sm-6'>
<div className={lastNameClass}>
- <input type='text' className='form-control' ref={'last_name' + index} placeholder='Last name' maxLength='64' />
+ <input type='text' className='form-control' ref={'last_name' + index} placeholder='Last name' maxLength='64' disabled={!this.state.emailEnabled}/>
{lastNameError}
</div>
</div>
@@ -212,7 +223,7 @@ module.exports = React.createClass({
<div key={'key' + index}>
{removeButton}
<div className={emailClass}>
- <input onKeyUp={this.displayNameKeyUp} type='text' ref={'email' + index} className='form-control' placeholder='email@domain.com' maxLength='64' />
+ <input onKeyUp={this.displayNameKeyUp} type='text' ref={'email' + index} className='form-control' placeholder='email@domain.com' maxLength='64' disabled={!this.state.emailEnabled}/>
{emailError}
</div>
{nameFields}
@@ -225,6 +236,45 @@ module.exports = React.createClass({
serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
}
+ var content = null;
+ var sendButton = null;
+ if (this.state.emailEnabled) {
+ content = (
+ <div>
+ {serverError}
+ <button type='button' className='btn btn-default' onClick={this.addInviteFields}>Add another</button>
+ <br/>
+ <br/>
+ <span>People invited automatically join Town Square channel.</span>
+ </div>
+ );
+
+ sendButton = <button onClick={this.handleSubmit} type='button' className='btn btn-primary'>Send Invitations</button>
+ } else {
+ var teamInviteLink = null;
+ if (currentUser && this.props.teamType === 'O') {
+ var linkUrl = utils.getWindowLocationOrigin() + '/signup_user_complete/?id=' + currentUser.team_id;
+ var link = <a href='#' data-toggle='modal' data-target='#get_link' data-title='Team Invite' data-value={linkUrl} onClick={
+ function() {
+ $('#invite_member').modal('hide');
+ }
+ }>Team Invite Link</a>;
+
+ teamInviteLink = (
+ <p>
+ You can also invite people using the {link}.
+ </p>
+ );
+ }
+
+ content = (
+ <div>
+ <p>Email is currently disabled for your team, and email invitations cannot be sent. Contact your system administrator to enable email and email invitations.</p>
+ {teamInviteLink}
+ </div>
+ );
+ }
+
return (
<div>
<div className='modal fade' ref='modal' id='invite_member' tabIndex='-1' role='dialog' aria-hidden='true'>
@@ -238,15 +288,11 @@ module.exports = React.createClass({
<form role='form'>
{inviteSections}
</form>
- {serverError}
- <button type='button' className='btn btn-default' onClick={this.addInviteFields}>Add another</button>
- <br/>
- <br/>
- <span>People invited automatically join Town Square channel.</span>
+ {content}
</div>
<div className='modal-footer'>
<button type='button' className='btn btn-default' data-dismiss='modal'>Cancel</button>
- <button onClick={this.handleSubmit} type='button' className='btn btn-primary'>Send Invitations</button>
+ {sendButton}
</div>
</div>
</div>