mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-23 19:20:47 +02:00
changes
This commit is contained in:
parent
cb771f6208
commit
723bb0816a
5 changed files with 22 additions and 23 deletions
|
@ -321,9 +321,9 @@ urlpatterns = [
|
||||||
name="user-profile",
|
name="user-profile",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"invitation/<int:pk>/delete",
|
"invitation/<int:pk>/cancel",
|
||||||
views.DomainInvitationDeleteView.as_view(http_method_names=["post"]),
|
views.DomainInvitationCancelView.as_view(http_method_names=["post"]),
|
||||||
name="invitation-delete",
|
name="invitation-cancel",
|
||||||
),
|
),
|
||||||
path(
|
path(
|
||||||
"domain-request/<int:pk>/delete",
|
"domain-request/<int:pk>/delete",
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
<td data-label="Status">{{ invitation.status|title }}</td>
|
<td data-label="Status">{{ invitation.status|title }}</td>
|
||||||
<td>
|
<td>
|
||||||
{% if invitation.status == invitation.DomainInvitationStatus.INVITED %}
|
{% if invitation.status == invitation.DomainInvitationStatus.INVITED %}
|
||||||
<form method="POST" action="{% url "invitation-delete" pk=invitation.id %}">
|
<form method="POST" action="{% url "invitation-cancel" pk=invitation.id %}">
|
||||||
{% csrf_token %}<input type="submit" class="usa-button--unstyled text-no-underline cursor-pointer" value="Cancel">
|
{% csrf_token %}<input type="submit" class="usa-button--unstyled text-no-underline cursor-pointer" value="Cancel">
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -200,7 +200,7 @@ def is_domain_subpage(path):
|
||||||
"domain-users-add",
|
"domain-users-add",
|
||||||
"domain-request-delete",
|
"domain-request-delete",
|
||||||
"domain-user-delete",
|
"domain-user-delete",
|
||||||
"invitation-delete",
|
"invitation-cancel",
|
||||||
]
|
]
|
||||||
return get_url_name(path) in url_names
|
return get_url_name(path) in url_names
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ from .domain import (
|
||||||
DomainSecurityEmailView,
|
DomainSecurityEmailView,
|
||||||
DomainUsersView,
|
DomainUsersView,
|
||||||
DomainAddUserView,
|
DomainAddUserView,
|
||||||
DomainInvitationDeleteView,
|
|
||||||
DomainInvitationCancelView,
|
DomainInvitationCancelView,
|
||||||
DomainDeleteUserView,
|
DomainDeleteUserView,
|
||||||
)
|
)
|
||||||
|
|
|
@ -1054,26 +1054,26 @@ class DomainAddUserView(DomainFormBaseView):
|
||||||
# # The order of the superclasses matters here. BaseDeleteView has a bug where the
|
# # 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.
|
# # "form_valid" function does not call super, so it cannot use SuccessMessageMixin.
|
||||||
# # The workaround is to use SuccessMessageMixin first.
|
# # The workaround is to use SuccessMessageMixin first.
|
||||||
class DomainInvitationDeleteView(SuccessMessageMixin, DomainInvitationPermissionDeleteView):
|
# class DomainInvitationDeleteView(SuccessMessageMixin, DomainInvitationPermissionDeleteView):
|
||||||
object: DomainInvitation # workaround for type mismatch in DeleteView
|
# object: DomainInvitation # workaround for type mismatch in DeleteView
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
# def post(self, request, *args, **kwargs):
|
||||||
"""Override post method in order to error in the case when the
|
# """Override post method in order to error in the case when the
|
||||||
domain invitation status is RETRIEVED"""
|
# domain invitation status is RETRIEVED"""
|
||||||
self.object = self.get_object()
|
# self.object = self.get_object()
|
||||||
form = self.get_form()
|
# form = self.get_form()
|
||||||
if form.is_valid() and self.object.status == self.object.DomainInvitationStatus.INVITED:
|
# if form.is_valid() and self.object.status == self.object.DomainInvitationStatus.INVITED:
|
||||||
return self.form_valid(form)
|
# return self.form_valid(form)
|
||||||
else:
|
# else:
|
||||||
# Produce an error message if the domain invatation status is RETRIEVED
|
# # Produce an error message if the domain invatation status is RETRIEVED
|
||||||
messages.error(request, f"Invitation to {self.object.email} has already been retrieved.")
|
# messages.error(request, f"Invitation to {self.object.email} has already been retrieved.")
|
||||||
return HttpResponseRedirect(self.get_success_url())
|
# return HttpResponseRedirect(self.get_success_url())
|
||||||
|
|
||||||
def get_success_url(self):
|
# def get_success_url(self):
|
||||||
return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
# return reverse("domain-users", kwargs={"pk": self.object.domain.id})
|
||||||
|
|
||||||
def get_success_message(self, cleaned_data):
|
# def get_success_message(self, cleaned_data):
|
||||||
return f"Canceled invitation to {self.object.email}."
|
# return f"Canceled invitation to {self.object.email}."
|
||||||
|
|
||||||
|
|
||||||
class DomainInvitationCancelView(SuccessMessageMixin, DomainInvitationUpdateView):
|
class DomainInvitationCancelView(SuccessMessageMixin, DomainInvitationUpdateView):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue