refactor: Avoid nesting in the compose invite handler.

We exit early now if email is undefined, rather than
having a big if statement.
This commit is contained in:
Steve Howell
2017-03-04 12:42:17 -08:00
committed by Tim Abbott
parent 24631a7405
commit 434f228135

View File

@@ -970,7 +970,10 @@ $(function () {
var invite_row = $(event.target).parents('.compose_invite_user');
var email = $(invite_row).data('useremail');
if (email !== undefined) {
if (email === undefined) {
return;
}
subs.invite_user_to_stream(email, compose.stream_name(), function () {
var all_invites = $("#compose_invite_users");
invite_row.remove();
@@ -984,7 +987,6 @@ $(function () {
$(event.target).attr('disabled', true);
});
}
});
$("#compose_invite_users").on('click', '.compose_invite_close', function (event) {