mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 23:43:43 +00:00
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:
@@ -970,7 +970,10 @@ $(function () {
|
|||||||
var invite_row = $(event.target).parents('.compose_invite_user');
|
var invite_row = $(event.target).parents('.compose_invite_user');
|
||||||
|
|
||||||
var email = $(invite_row).data('useremail');
|
var email = $(invite_row).data('useremail');
|
||||||
if (email !== undefined) {
|
if (email === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
subs.invite_user_to_stream(email, compose.stream_name(), function () {
|
subs.invite_user_to_stream(email, compose.stream_name(), function () {
|
||||||
var all_invites = $("#compose_invite_users");
|
var all_invites = $("#compose_invite_users");
|
||||||
invite_row.remove();
|
invite_row.remove();
|
||||||
@@ -984,7 +987,6 @@ $(function () {
|
|||||||
|
|
||||||
$(event.target).attr('disabled', true);
|
$(event.target).attr('disabled', true);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#compose_invite_users").on('click', '.compose_invite_close', function (event) {
|
$("#compose_invite_users").on('click', '.compose_invite_close', function (event) {
|
||||||
|
|||||||
Reference in New Issue
Block a user