Files
outline/app/models/User.ts
Tom Moor b7a6a34565 fix: Flash of empty state on paginated lists (#3351)
* fix: Flash of empty state on paginated lists
fix: Typing of PaginatedList to generic

* test

* test
2022-04-09 20:31:51 -07:00

55 lines
804 B
TypeScript

import { computed, observable } from "mobx";
import { Role } from "@shared/types";
import ParanoidModel from "./ParanoidModel";
import Field from "./decorators/Field";
class User extends ParanoidModel {
@Field
@observable
id: string;
@Field
@observable
avatarUrl: string;
@Field
@observable
name: string;
@Field
@observable
color: string;
@Field
@observable
language: string;
email: string;
isAdmin: boolean;
isViewer: boolean;
lastActiveAt: string;
isSuspended: boolean;
@computed
get isInvited(): boolean {
return !this.lastActiveAt;
}
@computed
get role(): Role {
if (this.isAdmin) {
return "admin";
} else if (this.isViewer) {
return "viewer";
} else {
return "member";
}
}
}
export default User;