import { Account } from '@app/shared/shared-main/account/account.model'
+import { objectKeysTyped } from '@shared/core-utils'
import { hasUserRight } from '@shared/core-utils/users'
import {
ActorImage,
pendingEmail: string | null
emailVerified: boolean
+ emailPublic: boolean
nsfwPolicy: NSFWPolicyType
adminFlags?: UserAdminFlag
videosHistoryEnabled: boolean
videoLanguages: string[]
- role: UserRole
- roleLabel: string
+ role: {
+ id: UserRole
+ label: string
+ }
videoQuota: number
videoQuotaDaily: number
}
hasRight (right: UserRight) {
- return hasUserRight(this.role, right)
+ return hasUserRight(this.role.id, right)
}
patch (obj: UserServerModel) {
- for (const key of Object.keys(obj)) {
- this[key] = obj[key]
+ for (const key of objectKeysTyped(obj)) {
+ // FIXME: typings
+ (this as any)[key] = obj[key]
}
if (obj.account !== undefined) {
isAutoBlocked (serverConfig: HTMLServerConfig) {
if (serverConfig.autoBlacklist.videos.ofUsers.enabled !== true) return false
- return this.role === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
+ return this.role.id === UserRole.USER && this.adminFlags !== UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST
}
}