]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/users/user.model.ts
Update translations
[github/Chocobozzz/PeerTube.git] / client / src / app / core / users / user.model.ts
index 6ba30e4b81f22425da822448918a99ac906d2bca..5534bca339e9bfd16b350cc832d9bba6729f5fb4 100644 (file)
@@ -34,8 +34,10 @@ export class User implements UserServerModel {
   videosHistoryEnabled: boolean
   videoLanguages: string[]
 
-  role: UserRole
-  roleLabel: string
+  role: {
+    id: UserRole
+    label: string
+  }
 
   videoQuota: number
   videoQuotaDaily: number
@@ -66,6 +68,8 @@ export class User implements UserServerModel {
 
   lastLoginDate: Date | null
 
+  twoFactorEnabled: boolean
+
   createdAt: Date
 
   constructor (hash: Partial<UserServerModel>) {
@@ -108,6 +112,8 @@ export class User implements UserServerModel {
 
     this.notificationSettings = hash.notificationSettings
 
+    this.twoFactorEnabled = hash.twoFactorEnabled
+
     this.createdAt = hash.createdAt
 
     this.pluginAuth = hash.pluginAuth
@@ -119,7 +125,7 @@ export class User implements UserServerModel {
   }
 
   hasRight (right: UserRight) {
-    return hasUserRight(this.role, right)
+    return hasUserRight(this.role.id, right)
   }
 
   patch (obj: UserServerModel) {
@@ -144,6 +150,6 @@ export class User implements UserServerModel {
   isAutoBlocked (serverConfig: HTMLServerConfig) {
     if (serverConfig.autoBlacklist.videos.ofUsers.enabled !== true) return false
 
-    return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
+    return this.role.id === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
   }
 }