diff options
Diffstat (limited to 'server/models/user')
-rw-r--r-- | server/models/user/user-notification-setting.ts | 2 | ||||
-rw-r--r-- | server/models/user/user-notification.ts | 6 | ||||
-rw-r--r-- | server/models/user/user-video-history.ts | 2 | ||||
-rw-r--r-- | server/models/user/user.ts | 15 |
4 files changed, 14 insertions, 11 deletions
diff --git a/server/models/user/user-notification-setting.ts b/server/models/user/user-notification-setting.ts index bee7d7851..f03b19e41 100644 --- a/server/models/user/user-notification-setting.ts +++ b/server/models/user/user-notification-setting.ts | |||
@@ -14,7 +14,7 @@ import { | |||
14 | } from 'sequelize-typescript' | 14 | } from 'sequelize-typescript' |
15 | import { TokensCache } from '@server/lib/auth/tokens-cache' | 15 | import { TokensCache } from '@server/lib/auth/tokens-cache' |
16 | import { MNotificationSettingFormattable } from '@server/types/models' | 16 | import { MNotificationSettingFormattable } from '@server/types/models' |
17 | import { AttributesOnly } from '@shared/core-utils' | 17 | import { AttributesOnly } from '@shared/typescript-utils' |
18 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' | 18 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model' |
19 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' | 19 | import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications' |
20 | import { throwIfNotValid } from '../utils' | 20 | import { throwIfNotValid } from '../utils' |
diff --git a/server/models/user/user-notification.ts b/server/models/user/user-notification.ts index 04c5513a9..edad10a55 100644 --- a/server/models/user/user-notification.ts +++ b/server/models/user/user-notification.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' | 1 | import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' |
2 | import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' |
3 | import { uuidToShort } from '@server/helpers/uuid' | ||
4 | import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' | 3 | import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' |
5 | import { AttributesOnly } from '@shared/core-utils' | 4 | import { uuidToShort } from '@shared/extra-utils' |
6 | import { UserNotification, UserNotificationType } from '../../../shared' | 5 | import { UserNotification, UserNotificationType } from '@shared/models' |
6 | import { AttributesOnly } from '@shared/typescript-utils' | ||
7 | import { isBooleanValid } from '../../helpers/custom-validators/misc' | 7 | import { isBooleanValid } from '../../helpers/custom-validators/misc' |
8 | import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications' | 8 | import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications' |
9 | import { AbuseModel } from '../abuse/abuse' | 9 | import { AbuseModel } from '../abuse/abuse' |
diff --git a/server/models/user/user-video-history.ts b/server/models/user/user-video-history.ts index 1aefdf02b..6d9f2e03f 100644 --- a/server/models/user/user-video-history.ts +++ b/server/models/user/user-video-history.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { DestroyOptions, Op, Transaction } from 'sequelize' | 1 | import { DestroyOptions, Op, Transaction } from 'sequelize' |
2 | import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Table, UpdatedAt } from 'sequelize-typescript' |
3 | import { MUserAccountId, MUserId } from '@server/types/models' | 3 | import { MUserAccountId, MUserId } from '@server/types/models' |
4 | import { AttributesOnly } from '@shared/core-utils' | 4 | import { AttributesOnly } from '@shared/typescript-utils' |
5 | import { VideoModel } from '../video/video' | 5 | import { VideoModel } from '../video/video' |
6 | import { UserModel } from './user' | 6 | import { UserModel } from './user' |
7 | import { getServerActor } from '../application/application' | 7 | import { getServerActor } from '../application/application' |
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index b56f37e55..4ad76e5bc 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -31,7 +31,7 @@ import { | |||
31 | MUserWithNotificationSetting, | 31 | MUserWithNotificationSetting, |
32 | MVideoWithRights | 32 | MVideoWithRights |
33 | } from '@server/types/models' | 33 | } from '@server/types/models' |
34 | import { AttributesOnly } from '@shared/core-utils' | 34 | import { AttributesOnly } from '@shared/typescript-utils' |
35 | import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users' | 35 | import { hasUserRight, USER_ROLE_LABELS } from '../../../shared/core-utils/users' |
36 | import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models' | 36 | import { AbuseState, MyUser, UserRight, VideoPlaylistType, VideoPrivacy } from '../../../shared/models' |
37 | import { User, UserRole } from '../../../shared/models/users' | 37 | import { User, UserRole } from '../../../shared/models/users' |
@@ -55,7 +55,7 @@ import { | |||
55 | isUserVideoQuotaDailyValid, | 55 | isUserVideoQuotaDailyValid, |
56 | isUserVideoQuotaValid, | 56 | isUserVideoQuotaValid, |
57 | isUserVideosHistoryEnabledValid, | 57 | isUserVideosHistoryEnabledValid, |
58 | isUserWebTorrentEnabledValid | 58 | isUserP2PEnabledValid |
59 | } from '../../helpers/custom-validators/users' | 59 | } from '../../helpers/custom-validators/users' |
60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' | 60 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' |
61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' | 61 | import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' |
@@ -267,10 +267,9 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
267 | nsfwPolicy: NSFWPolicyType | 267 | nsfwPolicy: NSFWPolicyType |
268 | 268 | ||
269 | @AllowNull(false) | 269 | @AllowNull(false) |
270 | @Default(true) | 270 | @Is('p2pEnabled', value => throwIfNotValid(value, isUserP2PEnabledValid, 'P2P enabled')) |
271 | @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled')) | ||
272 | @Column | 271 | @Column |
273 | webTorrentEnabled: boolean | 272 | p2pEnabled: boolean |
274 | 273 | ||
275 | @AllowNull(false) | 274 | @AllowNull(false) |
276 | @Default(true) | 275 | @Default(true) |
@@ -892,7 +891,11 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
892 | emailVerified: this.emailVerified, | 891 | emailVerified: this.emailVerified, |
893 | 892 | ||
894 | nsfwPolicy: this.nsfwPolicy, | 893 | nsfwPolicy: this.nsfwPolicy, |
895 | webTorrentEnabled: this.webTorrentEnabled, | 894 | |
895 | // FIXME: deprecated in 4.1 | ||
896 | webTorrentEnabled: this.p2pEnabled, | ||
897 | p2pEnabled: this.p2pEnabled, | ||
898 | |||
896 | videosHistoryEnabled: this.videosHistoryEnabled, | 899 | videosHistoryEnabled: this.videosHistoryEnabled, |
897 | autoPlayVideo: this.autoPlayVideo, | 900 | autoPlayVideo: this.autoPlayVideo, |
898 | autoPlayNextVideo: this.autoPlayNextVideo, | 901 | autoPlayNextVideo: this.autoPlayNextVideo, |