diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-12 18:12:39 +0200 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2018-10-13 11:53:48 +0200 |
commit | ed638e5325096ef580da20f370ac61c59cd48cf7 (patch) | |
tree | 8ad4c1001efb3adc3946a6b6c9a3c1ed1f557995 /server/models/account/user.ts | |
parent | 64cc5e8575fda47b281ae20abf0020e27fc8ce7c (diff) | |
download | PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.gz PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.zst PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.zip |
move to boolean switch
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r-- | server/models/account/user.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 5fe7d7e7d..4b4a562fa 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -32,7 +32,7 @@ import { | |||
32 | isUserUsernameValid, | 32 | isUserUsernameValid, |
33 | isUserVideoQuotaDailyValid, | 33 | isUserVideoQuotaDailyValid, |
34 | isUserVideoQuotaValid, | 34 | isUserVideoQuotaValid, |
35 | isUserWebTorrentPolicyValid | 35 | isUserWebTorrentEnabledValid |
36 | } from '../../helpers/custom-validators/users' | 36 | } from '../../helpers/custom-validators/users' |
37 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' | 37 | import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' |
38 | import { OAuthTokenModel } from '../oauth/oauth-token' | 38 | import { OAuthTokenModel } from '../oauth/oauth-token' |
@@ -40,9 +40,8 @@ import { getSort, throwIfNotValid } from '../utils' | |||
40 | import { VideoChannelModel } from '../video/video-channel' | 40 | import { VideoChannelModel } from '../video/video-channel' |
41 | import { AccountModel } from './account' | 41 | import { AccountModel } from './account' |
42 | import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' | 42 | import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' |
43 | import { WebTorrentPolicyType } from '../../../shared/models/users/user-webtorrent-policy.type' | ||
44 | import { values } from 'lodash' | 43 | import { values } from 'lodash' |
45 | import { NSFW_POLICY_TYPES, WEBTORRENT_POLICY_TYPES } from '../../initializers' | 44 | import { NSFW_POLICY_TYPES } from '../../initializers' |
46 | import { clearCacheByUserId } from '../../lib/oauth-model' | 45 | import { clearCacheByUserId } from '../../lib/oauth-model' |
47 | 46 | ||
48 | enum ScopeNames { | 47 | enum ScopeNames { |
@@ -110,9 +109,9 @@ export class UserModel extends Model<UserModel> { | |||
110 | nsfwPolicy: NSFWPolicyType | 109 | nsfwPolicy: NSFWPolicyType |
111 | 110 | ||
112 | @AllowNull(false) | 111 | @AllowNull(false) |
113 | @Is('UserWebTorrentPolicy', value => throwIfNotValid(value, isUserWebTorrentPolicyValid, 'WebTorrent policy')) | 112 | @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled')) |
114 | @Column(DataType.ENUM(values(WEBTORRENT_POLICY_TYPES))) | 113 | @Column |
115 | webTorrentPolicy: WebTorrentPolicyType | 114 | webTorrentEnabled: boolean |
116 | 115 | ||
117 | @AllowNull(false) | 116 | @AllowNull(false) |
118 | @Default(true) | 117 | @Default(true) |
@@ -362,7 +361,7 @@ export class UserModel extends Model<UserModel> { | |||
362 | email: this.email, | 361 | email: this.email, |
363 | emailVerified: this.emailVerified, | 362 | emailVerified: this.emailVerified, |
364 | nsfwPolicy: this.nsfwPolicy, | 363 | nsfwPolicy: this.nsfwPolicy, |
365 | webTorrentPolicy: this.webTorrentPolicy, | 364 | webTorrentEnabled: this.webTorrentEnabled, |
366 | autoPlayVideo: this.autoPlayVideo, | 365 | autoPlayVideo: this.autoPlayVideo, |
367 | role: this.role, | 366 | role: this.role, |
368 | roleLabel: USER_ROLE_LABELS[ this.role ], | 367 | roleLabel: USER_ROLE_LABELS[ this.role ], |