Merge pull request #458 from dod-ccpo/remove-revoke-from-expired-invite-#161933129
Remove option to revoke from expired workspace invitation
This commit is contained in:
commit
2dd26e6cf1
@ -87,3 +87,7 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
|
|||||||
@property
|
@property
|
||||||
def user_name(self):
|
def user_name(self):
|
||||||
return self.workspace_role.user.full_name
|
return self.workspace_role.user.full_name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_revokable(self):
|
||||||
|
return self.is_pending and not self.is_expired
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
<a href='{{ url_for("users.user") }}' class='icon-link'>edit account details</a>
|
<a href='{{ url_for("users.user") }}' class='icon-link'>edit account details</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div>
|
<div>
|
||||||
{% if member.latest_invitation.is_pending %}
|
{% if member.latest_invitation.is_revokable %}
|
||||||
{{ ConfirmationButton(
|
{{ ConfirmationButton(
|
||||||
"Revoke Invitation",
|
"Revoke Invitation",
|
||||||
url_for("workspaces.revoke_invitation", workspace_id=workspace.id, token=member.latest_invitation.token),
|
url_for("workspaces.revoke_invitation", workspace_id=workspace.id, token=member.latest_invitation.token),
|
||||||
|
23
tests/models/test_invitation.py
Normal file
23
tests/models/test_invitation.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import pytest
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
from atst.models.invitation import Invitation, Status
|
||||||
|
|
||||||
|
from tests.factories import InvitationFactory
|
||||||
|
|
||||||
|
|
||||||
|
def test_expired_invite_is_not_revokable():
|
||||||
|
invite = InvitationFactory.create(
|
||||||
|
expiration_time=datetime.datetime.now() - datetime.timedelta(minutes=60)
|
||||||
|
)
|
||||||
|
assert not invite.is_revokable
|
||||||
|
|
||||||
|
|
||||||
|
def test_unexpired_invite_is_revokable():
|
||||||
|
invite = InvitationFactory.create()
|
||||||
|
assert invite.is_revokable
|
||||||
|
|
||||||
|
|
||||||
|
def test_invite_is_not_revokable_if_invite_is_not_pending():
|
||||||
|
invite = InvitationFactory.create(status=Status.ACCEPTED)
|
||||||
|
assert not invite.is_revokable
|
Loading…
x
Reference in New Issue
Block a user