-import {
- Account as AccountServerModel,
- hasUserRight,
- User as UserServerModel,
- UserRight,
- UserRole,
- VideoChannel
-} from '../../../../../shared'
+import { hasUserRight, User as UserServerModel, 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 { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type'
-export type UserConstructorHash = {
- id: number,
- username: string,
- email: string,
- role: UserRole,
- videoQuota?: number,
- videoQuotaDaily?: number,
- nsfwPolicy?: NSFWPolicyType,
- webTorrentPolicy?: WebTorrentPolicyType,
- autoPlayVideo?: boolean,
- createdAt?: Date,
- account?: AccountServerModel,
- videoChannels?: VideoChannel[]
-
- blocked?: boolean
- blockedReason?: string
-}
export class User implements UserServerModel {
id: number
username: string
email: string
+ emailVerified: boolean
role: UserRole
nsfwPolicy: NSFWPolicyType
- webTorrentPolicy: WebTorrentPolicyType
+
+ webTorrentEnabled: boolean
autoPlayVideo: boolean
+ videosHistoryEnabled: boolean
+
videoQuota: number
videoQuotaDaily: number
account: Account
blocked: boolean
blockedReason?: string
- constructor (hash: UserConstructorHash) {
+ constructor (hash: Partial<UserServerModel>) {
this.id = hash.id
this.username = hash.username
this.email = hash.email
this.videoQuota = hash.videoQuota
this.videoQuotaDaily = hash.videoQuotaDaily
this.nsfwPolicy = hash.nsfwPolicy
- this.webTorrentPolicy = hash.webTorrentPolicy
+ this.webTorrentEnabled = hash.webTorrentEnabled
+ this.videosHistoryEnabled = hash.videosHistoryEnabled
this.autoPlayVideo = hash.autoPlayVideo
this.createdAt = hash.createdAt
this.blocked = hash.blocked