X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fusers%2Fuser.model.ts;h=7707d7dda7ecc73bda9d2b7ec485de0b7c224b85;hb=dd4f25eea802fd88ea641d730432b56f562e0861;hp=581ea785964d2dee22ac251d5f2571f0adb7ca91;hpb=52d9f792b3fee5acce80f948295b59e3ad2073eb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/users/user.model.ts b/client/src/app/shared/users/user.model.ts index 581ea7859..7707d7dda 100644 --- a/client/src/app/shared/users/user.model.ts +++ b/client/src/app/shared/users/user.model.ts @@ -1,68 +1,84 @@ -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 { Actor } from '@app/shared/actor/actor.model' 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[] -} export class User implements UserServerModel { id: number username: string email: string - role: UserRole + pendingEmail: string | null + + emailVerified: boolean nsfwPolicy: NSFWPolicyType + + adminFlags?: UserAdminFlag + autoPlayVideo: boolean + autoPlayNextVideo: boolean + autoPlayNextVideoPlaylist: boolean + webTorrentEnabled: boolean + videosHistoryEnabled: boolean + videoLanguages: string[] + + role: UserRole + roleLabel: string + videoQuota: number + videoQuotaDaily: number + videoQuotaUsed?: number + videoQuotaUsedDaily?: number + + theme: string + account: Account - videoChannels: VideoChannel[] + notificationSettings?: UserNotificationSetting + videoChannels?: VideoChannel[] + + blocked: boolean + blockedReason?: string + + noInstanceConfigWarningModal: boolean + noWelcomeModal: boolean + createdAt: Date - constructor (hash: UserConstructorHash) { + constructor (hash: Partial) { this.id = hash.id this.username = hash.username this.email = hash.email + this.role = hash.role - if (hash.account !== undefined) { - this.account = new Account(hash.account) - } + this.videoChannels = hash.videoChannels - if (hash.videoChannels !== undefined) { - this.videoChannels = hash.videoChannels - } + this.videoQuota = hash.videoQuota + this.videoQuotaDaily = hash.videoQuotaDaily + this.videoQuotaUsed = hash.videoQuotaUsed + this.videoQuotaUsedDaily = hash.videoQuotaUsedDaily - if (hash.videoQuota !== undefined) { - this.videoQuota = hash.videoQuota - } + this.nsfwPolicy = hash.nsfwPolicy + this.webTorrentEnabled = hash.webTorrentEnabled + this.videosHistoryEnabled = hash.videosHistoryEnabled + this.autoPlayVideo = hash.autoPlayVideo - if (hash.nsfwPolicy !== undefined) { - this.nsfwPolicy = hash.nsfwPolicy - } + this.theme = hash.theme - if (hash.autoPlayVideo !== undefined) { - this.autoPlayVideo = hash.autoPlayVideo - } + this.adminFlags = hash.adminFlags + + this.blocked = hash.blocked + this.blockedReason = hash.blockedReason + + this.noInstanceConfigWarningModal = hash.noInstanceConfigWarningModal + this.noWelcomeModal = hash.noWelcomeModal + + this.notificationSettings = hash.notificationSettings - if (hash.createdAt !== undefined) { - this.createdAt = hash.createdAt + this.createdAt = hash.createdAt + + if (hash.account !== undefined) { + this.account = new Account(hash.account) } }