]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/users/user.model.ts
Add ability to change email in client
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / users / user.model.ts
index 2748001d046c57eb4718d913feb82218f8f94ac3..14d13959af129b7ac9716c8535e6ff580a7c601c 100644 (file)
@@ -1,59 +1,60 @@
-import {
-  Account as AccountServerModel,
-  hasUserRight,
-  User as UserServerModel,
-  UserRight,
-  UserRole,
-  VideoChannel
-} from '../../../../../shared'
+import { hasUserRight, User as UserServerModel, UserNotificationSetting, UserRight, UserRole, VideoChannel } from '../../../../../shared'
 import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
 import { Account } from '@app/shared/account/account.model'
 import { Avatar } from '../../../../../shared/models/avatars/avatar.model'
+import { UserAdminFlag } from '@shared/models/users/user-flag.model'
 
-export type UserConstructorHash = {
-  id: number,
-  username: string,
-  email: string,
-  role: UserRole,
-  videoQuota?: number,
-  nsfwPolicy?: NSFWPolicyType,
-  autoPlayVideo?: boolean,
-  createdAt?: Date,
-  account?: AccountServerModel,
-  videoChannels?: VideoChannel[]
-
-  blocked?: boolean
-  blockedReason?: string
-}
 export class User implements UserServerModel {
   id: number
   username: string
   email: string
-  role: UserRole
+  pendingEmail: string | null
+  emailVerified: boolean
   nsfwPolicy: NSFWPolicyType
+
+  role: UserRole
+  roleLabel: string
+
+  webTorrentEnabled: boolean
   autoPlayVideo: boolean
+  videosHistoryEnabled: boolean
+
   videoQuota: number
+  videoQuotaDaily: number
   account: Account
   videoChannels: VideoChannel[]
   createdAt: Date
 
+  adminFlags?: UserAdminFlag
+
   blocked: boolean
   blockedReason?: string
 
-  constructor (hash: UserConstructorHash) {
+  notificationSettings?: UserNotificationSetting
+
+  constructor (hash: Partial<UserServerModel>) {
     this.id = hash.id
     this.username = hash.username
     this.email = hash.email
+
     this.role = hash.role
 
     this.videoChannels = hash.videoChannels
     this.videoQuota = hash.videoQuota
+    this.videoQuotaDaily = hash.videoQuotaDaily
     this.nsfwPolicy = hash.nsfwPolicy
+    this.webTorrentEnabled = hash.webTorrentEnabled
+    this.videosHistoryEnabled = hash.videosHistoryEnabled
     this.autoPlayVideo = hash.autoPlayVideo
     this.createdAt = hash.createdAt
+
+    this.adminFlags = hash.adminFlags
+
     this.blocked = hash.blocked
     this.blockedReason = hash.blockedReason
 
+    this.notificationSettings = hash.notificationSettings
+
     if (hash.account !== undefined) {
       this.account = new Account(hash.account)
     }