]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
Fix AP collections pagination
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
index 5fe7d7e7d94aa00864ed6d3a954d02cc623fd8e0..34aafa1a7c586abc7930d471a5dcd78582b2a970 100644 (file)
@@ -32,7 +32,7 @@ import {
   isUserUsernameValid,
   isUserVideoQuotaDailyValid,
   isUserVideoQuotaValid,
-  isUserWebTorrentPolicyValid
+  isUserWebTorrentEnabledValid
 } from '../../helpers/custom-validators/users'
 import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
 import { OAuthTokenModel } from '../oauth/oauth-token'
@@ -40,9 +40,8 @@ import { getSort, throwIfNotValid } from '../utils'
 import { VideoChannelModel } from '../video/video-channel'
 import { AccountModel } from './account'
 import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
-import { WebTorrentPolicyType } from '../../../shared/models/users/user-webtorrent-policy.type'
 import { values } from 'lodash'
-import { NSFW_POLICY_TYPES, WEBTORRENT_POLICY_TYPES } from '../../initializers'
+import { NSFW_POLICY_TYPES } from '../../initializers'
 import { clearCacheByUserId } from '../../lib/oauth-model'
 
 enum ScopeNames {
@@ -110,9 +109,10 @@ export class UserModel extends Model<UserModel> {
   nsfwPolicy: NSFWPolicyType
 
   @AllowNull(false)
-  @Is('UserWebTorrentPolicy', value => throwIfNotValid(value, isUserWebTorrentPolicyValid, 'WebTorrent policy'))
-  @Column(DataType.ENUM(values(WEBTORRENT_POLICY_TYPES)))
-  webTorrentPolicy: WebTorrentPolicyType
+  @Default(true)
+  @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled'))
+  @Column
+  webTorrentEnabled: boolean
 
   @AllowNull(false)
   @Default(true)
@@ -362,7 +362,7 @@ export class UserModel extends Model<UserModel> {
       email: this.email,
       emailVerified: this.emailVerified,
       nsfwPolicy: this.nsfwPolicy,
-      webTorrentPolicy: this.webTorrentPolicy,
+      webTorrentEnabled: this.webTorrentEnabled,
       autoPlayVideo: this.autoPlayVideo,
       role: this.role,
       roleLabel: USER_ROLE_LABELS[ this.role ],