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
|
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
|
@property
|
||||||
def workspace(self):
|
def workspace(self):
|
||||||
if self.workspace_role:
|
if self.workspace_role:
|
||||||
|
@ -152,12 +152,7 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
|
|||||||
@property
|
@property
|
||||||
def can_resend_invitation(self):
|
def can_resend_invitation(self):
|
||||||
return not self.is_active and (
|
return not self.is_active and (
|
||||||
self.latest_invitation
|
self.latest_invitation and self.latest_invitation.is_inactive
|
||||||
and (
|
|
||||||
self.latest_invitation.is_rejected
|
|
||||||
or self.latest_invitation.is_expired
|
|
||||||
or self.latest_invitation.is_revoked
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user