import { hasUserRight, User as UserServerModel, UserRight, UserRole, VideoChannel } from '../../../../../shared'
import { Account } from '../account/account.model'
+import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
export type UserConstructorHash = {
id: number,
email: string,
role: UserRole,
videoQuota?: number,
- displayNSFW?: boolean,
+ nsfwPolicy?: NSFWPolicyType,
autoPlayVideo?: boolean,
createdAt?: Date,
account?: Account,
username: string
email: string
role: UserRole
- displayNSFW: boolean
+ nsfwPolicy: NSFWPolicyType
autoPlayVideo: boolean
videoQuota: number
account: Account
this.videoQuota = hash.videoQuota
}
- if (hash.displayNSFW !== undefined) {
- this.displayNSFW = hash.displayNSFW
+ if (hash.nsfwPolicy !== undefined) {
+ this.nsfwPolicy = hash.nsfwPolicy
}
if (hash.autoPlayVideo !== undefined) {
getAvatarUrl () {
return Account.GET_ACCOUNT_AVATAR_URL(this.account)
}
+
+ patch (obj: UserServerModel) {
+ for (const key of Object.keys(obj)) {
+ this[key] = obj[key]
+ }
+ }
}