summaryrefslogtreecommitdiffstats
path: root/web/react/components
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components')
-rw-r--r--web/react/components/invite_member_modal.jsx18
1 files changed, 16 insertions, 2 deletions
diff --git a/web/react/components/invite_member_modal.jsx b/web/react/components/invite_member_modal.jsx
index d1672126d..bfcbfc94f 100644
--- a/web/react/components/invite_member_modal.jsx
+++ b/web/react/components/invite_member_modal.jsx
@@ -43,6 +43,7 @@ module.exports = React.createClass({
var first_name_errors = this.state.first_name_errors;
var last_name_errors = this.state.last_name_errors;
var valid = true;
+ var profiles = UserStore.getProfiles();
for (var i = 0; i < count; i++) {
var index = invite_ids[i];
@@ -52,6 +53,13 @@ module.exports = React.createClass({
email_errors[index] = "Please enter a valid email address";
valid = false;
} else {
+ for (var email in profiles) {
+ if (email === invite.email) {
+ email_errors[index] = "This person is already on your team";
+ valid = false;
+ }
+ }
+
email_errors[index] = "";
}
@@ -89,7 +97,12 @@ module.exports = React.createClass({
$(this.refs.modal.getDOMNode()).modal('hide');
}.bind(this),
function(err) {
- this.setState({ server_error: err });
+ if (err.message === "This person is already on your team") {
+ email_errors[err.detailed_error] = err.message;
+ this.setState({ email_errors: email_errors });
+ }
+ else
+ this.setState({ server_error: err.message});
}.bind(this)
);
@@ -138,7 +151,8 @@ module.exports = React.createClass({
id_count: 0,
email_errors: {},
first_name_errors: {},
- last_name_errors: {}
+ last_name_errors: {},
+ server_errors: {}
};
},
render: function() {