diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/user.ts | 11 |
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' | |||
44 | import { AccountModel } from './account' | 44 | import { AccountModel } from './account' |
45 | import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' | 45 | import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' |
46 | import { values } from 'lodash' | 46 | import { values } from 'lodash' |
47 | import { NSFW_POLICY_TYPES } from '../../initializers/constants' | 47 | import { DEFAULT_THEME, NSFW_POLICY_TYPES } from '../../initializers/constants' |
48 | import { clearCacheByUserId } from '../../lib/oauth-model' | 48 | import { clearCacheByUserId } from '../../lib/oauth-model' |
49 | import { UserNotificationSettingModel } from './user-notification-setting' | 49 | import { UserNotificationSettingModel } from './user-notification-setting' |
50 | import { VideoModel } from '../video/video' | 50 | import { VideoModel } from '../video/video' |
@@ -52,6 +52,8 @@ import { ActorModel } from '../activitypub/actor' | |||
52 | import { ActorFollowModel } from '../activitypub/actor-follow' | 52 | import { ActorFollowModel } from '../activitypub/actor-follow' |
53 | import { VideoImportModel } from '../video/video-import' | 53 | import { VideoImportModel } from '../video/video-import' |
54 | import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' | 54 | import { UserAdminFlag } from '../../../shared/models/users/user-flag.model' |
55 | import { isThemeValid } from '../../helpers/custom-validators/plugins' | ||
56 | import { getThemeOrDefault } from '../../lib/plugins/theme-utils' | ||
55 | 57 | ||
56 | enum ScopeNames { | 58 | enum 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, |