Move logic about invite into Invitation model
This commit is contained in:
parent
9597966bcd
commit
fa2cad3291
@ -82,6 +82,14 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
|
||||
and not self.status == Status.ACCEPTED
|
||||
)
|
||||
|
||||
@property
|
||||
def is_inactive(self):
|
||||
return self.is_expired or self.status in [
|
||||
Status.REJECTED_WRONG_USER,
|
||||
Status.REJECTED_EXPIRED,
|
||||
Status.REVOKED,
|
||||
]
|
||||
|
||||
@property
|
||||
def workspace(self):
|
||||
if self.workspace_role:
|
||||
|
@ -152,12 +152,7 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
|
||||
@property
|
||||
def can_resend_invitation(self):
|
||||
return not self.is_active and (
|
||||
self.latest_invitation
|
||||
and (
|
||||
self.latest_invitation.is_rejected
|
||||
or self.latest_invitation.is_expired
|
||||
or self.latest_invitation.is_revoked
|
||||
)
|
||||
self.latest_invitation and self.latest_invitation.is_inactive
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user