From 8f736e6917526540966f6eccfb3d548752be8567 Mon Sep 17 00:00:00 2001 From: sahil839 Date: Mon, 28 Sep 2020 17:26:37 +0530 Subject: [PATCH] invite: Fix text of submit-invitation button on completion. There is a bug in invite flow, where the button text resets to incorrect text after the invitation process is completed. This bug is because we are using $().button("reset") to reset the button text, but the data-reset-text attribute of button is not changed when toggling between multi-use link invite and email invites. This bug can be fixed by setting data-reset-text attribute in a way similar to the way we set data-loading-text attribute on toggling between multiuse and normal invites. But according to the bootstrap docs,"reset" method was removed in v4.0 (https://getbootstrap.com/docs/4.0/migration/#buttons). Though we are not using Bootstrap v4.0 as of now, but it is good to remove such methods as it will help in future when we would upgrade to later bootstrap versions. So instead of fixing this by above mentioned patch, we are fixing this by removing "reset" method and instead using simple jquery to reset the text and enable the button after the invite process is completed. --- static/js/invite.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/invite.js b/static/js/invite.js index af25aa926c..1099986a5a 100644 --- a/static/js/invite.js +++ b/static/js/invite.js @@ -98,7 +98,8 @@ function submit_invitation_form() { } }, complete() { - $("#submit-invitation").button("reset"); + $("#submit-invitation").text(i18n.t("Invite")); + $("#submit-invitation").prop("disabled", false); $("#invitee_emails").focus(); ui.get_scroll_element($("#invite_user_form .modal-body"))[0].scrollTop = 0; }, @@ -124,7 +125,8 @@ function generate_multiuse_invite() { ui_report.error("", xhr, invite_status); }, complete() { - $("#submit-invitation").button("reset"); + $("#submit-invitation").text(i18n.t("Generate invite link")); + $("#submit-invitation").prop("disabled", false); }, }); }