Bug 42638: Cannot delete an identity provider domain

This patch updates the identity provider domain page so that clicking
the "Delete" button from the list of existing identity providers works
correctly.

There's a lot of unfinished copy and paste from the SMTP servers page,
including a missing chuck of modal dialog HTML.

To test, apply the patch and go to Administration -> Identity providers.

- If necessary, add at least one identity provider.
- Click the "Manage domains" button for an identity provider.
- If necessary, add at least one identity provider domain.
- Click the delete button corresponding to the domain you added.
  - A confirmation modal should appear.
  - Clicking "Close" should close the modal without triggering any
    action.
  - Clicking "Delete" should delete the domain.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2026-05-18 14:08:53 -04:00 committed by Lucas Gass
parent c1a369d274
commit 6572a5aec0
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 26 additions and 4 deletions

View File

@ -321,6 +321,27 @@
</thead>
</table>
</div>
<div id="delete_confirm_modal" class="modal" tabindex="-1" role="dialog" aria-labelledby="delete_confirm_modal_label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="delete_confirm_modal_label">Confirm deletion of identity provider domain</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div id="delete_confirm_dialog"></div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-danger" id="delete_confirm_modal_button" role="button">Delete</a>
<button type="button" class="btn btn-default" data-bs-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- #delete_confirm_modal -->
[% END %]
[% END %]
@ -462,7 +483,7 @@
"</a>" +
"\n";
result +=
'<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-bs-toggle="modal" data-bs-target="#delete_confirm_modal" data-auth-provider-domain-id="' +
'<a class="btn btn-default btn-xs delete_identity_provider_domain" role="button" href="#" data-auth-provider-domain-id="' +
encodeURIComponent(row.identity_provider_domain_id) +
'" data-auth-provider-domain="' +
encodeURIComponent((row.domain || "").escapeHtml()) +
@ -489,6 +510,7 @@
$("#delete_confirm_dialog").html(_("You are about to delete the '%s' identity provider domain.").format(identity_provider_domain));
$("#delete_confirm_modal_button").data("auth-provider-domain-id", identity_provider_domain_id);
$("#delete_confirm_modal_button").data("auth-provider-domain", identity_provider_domain);
$("#delete_confirm_modal").modal("show");
});
$("#delete_confirm_modal_button").on("click", function () {
@ -501,12 +523,12 @@
})
.success(function () {
window.identity_provider_domains.api().ajax.reload(function (data) {
$("#smtp_action_result_dialog").hide();
$("#smtp_delete_success").html(_("Server '%s' deleted successfully.").format(identity_provider_domain)).show();
$("#identity_provider_domain_action_result_dialog").hide();
$("#identity_provider_domain_delete_success").html(_("Domain '%s' deleted successfully.").format(identity_provider_domain)).show();
});
})
.fail(function () {
$("#smtp_delete_error").html(_("Error deleting server '%s'. Check the logs for details.").format(identity_provider_domain)).show();
$("#smtp_delete_error").html(_("Error deleting domain '%s'. Check the logs for details.").format(identity_provider_domain)).show();
})
.done(function () {
$("#delete_confirm_modal").modal("hide");