]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/users/user.model.ts
Client: Handle NSFW video
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
1 export class User {
2 id: number;
3 username: string;
4 role: string;
5 displayNSFW: boolean;
6 createdAt: Date;
7
8 constructor(hash: {
9 id: number,
10 username: string,
11 role: string,
12 displayNSFW?: boolean,
13 createdAt?: Date,
14 }) {
15 this.id = hash.id;
16 this.username = hash.username;
17 this.role = hash.role;
18 this.displayNSFW = hash.displayNSFW;
19
20 if (hash.createdAt) {
21 this.createdAt = hash.createdAt;
22 }
23 }
24
25 isAdmin() {
26 return this.role === 'admin';
27 }
28 }