Merge pull request #1767 from cisagov/za/1601-cancel-invitation-message

(on getgov-backup) Ticket #1601: Add "Cancel invitation" success message
This commit is contained in:
zandercymatics 2024-02-15 10:31:37 -07:00 committed by GitHub
commit 00434d3461
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -786,14 +786,17 @@ class DomainAddUserView(DomainFormBaseView):
return redirect(self.get_success_url())
class DomainInvitationDeleteView(DomainInvitationPermissionDeleteView, SuccessMessageMixin):
# The order of the superclasses matters here. BaseDeleteView has a bug where the
# "form_valid" function does not call super, so it cannot use SuccessMessageMixin.
# The workaround is to use SuccessMessageMixin first.
class DomainInvitationDeleteView(SuccessMessageMixin, DomainInvitationPermissionDeleteView):
object: DomainInvitation # workaround for type mismatch in DeleteView
def get_success_url(self):
return reverse("domain-users", kwargs={"pk": self.object.domain.id})
def get_success_message(self, cleaned_data):
return f"Successfully canceled invitation for {self.object.email}."
return f"Canceled invitation to {self.object.email}."
class DomainDeleteUserView(UserDomainRolePermissionDeleteView):