]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/users/user.model.ts
publish comment on crtl-enter (#290)
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
index b4d13f37c3dda021cdbfbe17bba5606168d8c754..4a94b032d6f6670bbe2a613540c871ce0778ef19 100644 (file)
@@ -8,6 +8,7 @@ export type UserConstructorHash = {
   role: UserRole,
   videoQuota?: number,
   displayNSFW?: boolean,
+  autoPlayVideo?: boolean,
   createdAt?: Date,
   account?: Account,
   videoChannels?: VideoChannel[]
@@ -18,6 +19,7 @@ export class User implements UserServerModel {
   email: string
   role: UserRole
   displayNSFW: boolean
+  autoPlayVideo: boolean
   videoQuota: number
   account: Account
   videoChannels: VideoChannel[]
@@ -42,6 +44,10 @@ export class User implements UserServerModel {
       this.displayNSFW = hash.displayNSFW
     }
 
+    if (hash.autoPlayVideo !== undefined) {
+      this.autoPlayVideo = hash.autoPlayVideo
+    }
+
     if (hash.createdAt !== undefined) {
       this.createdAt = hash.createdAt
     }
@@ -51,7 +57,13 @@ export class User implements UserServerModel {
     return hasUserRight(this.role, right)
   }
 
-  getAvatarPath () {
-    return Account.GET_ACCOUNT_AVATAR_PATH(this.account)
+  getAvatarUrl () {
+    return Account.GET_ACCOUNT_AVATAR_URL(this.account)
+  }
+
+  patch (obj: UserServerModel) {
+    for (const key of Object.keys(obj)) {
+      this[key] = obj[key]
+    }
   }
 }