Show proper display_status

This commit is contained in:
richard-dds 2018-11-19 16:25:11 -05:00
parent ae70a551a9
commit fa8c59b944

View File

@ -20,6 +20,7 @@ MEMBER_STATUSES = {
"error": "Error on invite",
"pending": "Pending",
"unknown": "Unknown errors",
"disabled": "Disabled"
}
@ -83,6 +84,8 @@ class WorkspaceRole(Base, mixins.TimestampsMixin, mixins.AuditableMixin):
def display_status(self):
if self.status == Status.ACTIVE:
return MEMBER_STATUSES["active"]
elif self.status == Status.DISABLED:
return MEMBER_STATUSES["disabled"]
elif self.latest_invitation:
if self.latest_invitation.is_revoked:
return MEMBER_STATUSES["revoked"]