import { AccountModel } from './account'
import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
import { values } from 'lodash'
-import { NSFW_POLICY_TYPES } from '../../initializers/constants'
+import { DEFAULT_THEME_NAME, DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
import { clearCacheByUserId } from '../../lib/oauth-model'
import { UserNotificationSettingModel } from './user-notification-setting'
import { VideoModel } from '../video/video'
import { ActorFollowModel } from '../activitypub/actor-follow'
import { VideoImportModel } from '../video/video-import'
import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
+import { isThemeNameValid } from '../../helpers/custom-validators/plugins'
+import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
enum ScopeNames {
WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL'
@Column(DataType.BIGINT)
videoQuotaDaily: number
+ @AllowNull(false)
+ @Default(DEFAULT_THEME_NAME)
+ @Is('UserTheme', value => throwIfNotValid(value, isThemeNameValid, 'theme'))
+ @Column
+ theme: string
+
@CreatedAt
createdAt: Date
static loadByUsername (username: string) {
const query = {
where: {
- username
+ username: { [ Op.iLike ]: username }
}
}
static loadByUsernameAndPopulateChannels (username: string) {
const query = {
where: {
- username
+ username: { [ Op.iLike ]: username }
}
}
const query = {
where: {
- [ Op.or ]: [ { username }, { email } ]
+ [ Op.or ]: [ { username: { [ Op.iLike ]: username } }, { email } ]
}
}
autoPlayVideo: this.autoPlayVideo,
videoLanguages: this.videoLanguages,
role: this.role,
+ theme: getThemeOrDefault(this.theme, DEFAULT_USER_THEME_NAME),
roleLabel: USER_ROLE_LABELS[ this.role ],
videoQuota: this.videoQuota,
videoQuotaDaily: this.videoQuotaDaily,