aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/user.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 0f425bb82..b8ca1dd5c 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -44,7 +44,7 @@ import { VideoChannelModel } from '../video/video-channel'
44import { AccountModel } from './account' 44import { AccountModel } from './account'
45import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' 45import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
46import { values } from 'lodash' 46import { values } from 'lodash'
47import { NSFW_POLICY_TYPES } from '../../initializers/constants' 47import { DEFAULT_THEME, NSFW_POLICY_TYPES } from '../../initializers/constants'
48import { clearCacheByUserId } from '../../lib/oauth-model' 48import { clearCacheByUserId } from '../../lib/oauth-model'
49import { UserNotificationSettingModel } from './user-notification-setting' 49import { UserNotificationSettingModel } from './user-notification-setting'
50import { VideoModel } from '../video/video' 50import { VideoModel } from '../video/video'
@@ -52,6 +52,8 @@ import { ActorModel } from '../activitypub/actor'
52import { ActorFollowModel } from '../activitypub/actor-follow' 52import { ActorFollowModel } from '../activitypub/actor-follow'
53import { VideoImportModel } from '../video/video-import' 53import { VideoImportModel } from '../video/video-import'
54import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' 54import { UserAdminFlag } from '../../../shared/models/users/user-flag.model'
55import { isThemeValid } from '../../helpers/custom-validators/plugins'
56import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
55 57
56enum ScopeNames { 58enum ScopeNames {
57 WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' 59 WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL'
@@ -187,6 +189,12 @@ export class UserModel extends Model<UserModel> {
187 @Column(DataType.BIGINT) 189 @Column(DataType.BIGINT)
188 videoQuotaDaily: number 190 videoQuotaDaily: number
189 191
192 @AllowNull(false)
193 @Default(DEFAULT_THEME)
194 @Is('UserTheme', value => throwIfNotValid(value, isThemeValid, 'theme'))
195 @Column
196 theme: string
197
190 @CreatedAt 198 @CreatedAt
191 createdAt: Date 199 createdAt: Date
192 200
@@ -560,6 +568,7 @@ export class UserModel extends Model<UserModel> {
560 autoPlayVideo: this.autoPlayVideo, 568 autoPlayVideo: this.autoPlayVideo,
561 videoLanguages: this.videoLanguages, 569 videoLanguages: this.videoLanguages,
562 role: this.role, 570 role: this.role,
571 theme: getThemeOrDefault(this.theme),
563 roleLabel: USER_ROLE_LABELS[ this.role ], 572 roleLabel: USER_ROLE_LABELS[ this.role ],
564 videoQuota: this.videoQuota, 573 videoQuota: this.videoQuota,
565 videoQuotaDaily: this.videoQuotaDaily, 574 videoQuotaDaily: this.videoQuotaDaily,