summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-08-11 15:48:07 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-08-11 16:53:15 -0400
commit37909f52ad4f9cca9ffecd008956912b4a6cf5c7 (patch)
tree0e6630c5fa510ef288a30502b3f94cba20c91c13
parente27ba7454d0bfe9f50736edcc15d0c47bfd48089 (diff)
downloadchat-37909f52ad4f9cca9ffecd008956912b4a6cf5c7.tar.gz
chat-37909f52ad4f9cca9ffecd008956912b4a6cf5c7.tar.bz2
chat-37909f52ad4f9cca9ffecd008956912b4a6cf5c7.zip
Disabled the invite members dialog when email is disabled on the server
-rw-r--r--web/react/components/invite_member_modal.jsx65
-rw-r--r--web/react/pages/channel.jsx2
2 files changed, 56 insertions, 11 deletions
diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx
index 3eca79bae..fb3d46b0a 100644
--- a/web/react/components/invite_member_modal.jsx
+++ b/web/react/components/invite_member_modal.jsx
@@ -35,6 +35,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 +151,18 @@ module.exports = React.createClass({
idCount: 0,
emailErrors: {},
firstNameErrors: {},
- lastNameErrors: {}
+ lastNameErrors: {},
+ emailEnabled: Client.isEmailEnabledSynchronous()
};
},
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 +205,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 +222,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 +235,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 +287,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>
diff --git a/web/react/pages/channel.jsx b/web/react/pages/channel.jsx
index 90d90b29f..99d5c5e9f 100644
--- a/web/react/pages/channel.jsx
+++ b/web/react/pages/channel.jsx
@@ -99,7 +99,7 @@ global.window.setup_channel_page = function(team_name, team_type, team_id, chann
);
React.render(
- <MemberInviteModal />,
+ <MemberInviteModal teamType={team_type} />,
document.getElementById('invite_member_modal')
);