aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2018-10-12 18:12:39 +0200
committerRigel Kent <sendmemail@rigelk.eu>2018-10-13 11:53:48 +0200
commited638e5325096ef580da20f370ac61c59cd48cf7 (patch)
tree8ad4c1001efb3adc3946a6b6c9a3c1ed1f557995 /client/src/app/core
parent64cc5e8575fda47b281ae20abf0020e27fc8ce7c (diff)
downloadPeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.gz
PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.tar.zst
PeerTube-ed638e5325096ef580da20f370ac61c59cd48cf7.zip
move to boolean switch
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/auth/auth-user.model.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/client/src/app/core/auth/auth-user.model.ts b/client/src/app/core/auth/auth-user.model.ts
index 97acf7bfe..acd13d9c5 100644
--- a/client/src/app/core/auth/auth-user.model.ts
+++ b/client/src/app/core/auth/auth-user.model.ts
@@ -4,7 +4,6 @@ import { UserRight } from '../../../../../shared/models/users/user-right.enum'
4import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role' 4import { hasUserRight, UserRole } from '../../../../../shared/models/users/user-role'
5import { User, UserConstructorHash } from '../../shared/users/user.model' 5import { User, UserConstructorHash } from '../../shared/users/user.model'
6import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type' 6import { NSFWPolicyType } from '../../../../../shared/models/videos/nsfw-policy.type'
7import { WebTorrentPolicyType } from '../../../../../shared/models/users/user-webtorrent-policy.type'
8 7
9export type TokenOptions = { 8export type TokenOptions = {
10 accessToken: string 9 accessToken: string
@@ -73,7 +72,7 @@ export class AuthUser extends User {
73 EMAIL: 'email', 72 EMAIL: 'email',
74 USERNAME: 'username', 73 USERNAME: 'username',
75 NSFW_POLICY: 'nsfw_policy', 74 NSFW_POLICY: 'nsfw_policy',
76 WEBTORRENT_POLICY: 'peertube-videojs-' + 'webtorrent_policy', 75 WEBTORRENT_ENABLED: 'peertube-videojs-' + 'webtorrent_enabled',
77 AUTO_PLAY_VIDEO: 'auto_play_video' 76 AUTO_PLAY_VIDEO: 'auto_play_video'
78 } 77 }
79 78
@@ -89,7 +88,7 @@ export class AuthUser extends User {
89 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL), 88 email: peertubeLocalStorage.getItem(this.KEYS.EMAIL),
90 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole, 89 role: parseInt(peertubeLocalStorage.getItem(this.KEYS.ROLE), 10) as UserRole,
91 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType, 90 nsfwPolicy: peertubeLocalStorage.getItem(this.KEYS.NSFW_POLICY) as NSFWPolicyType,
92 webTorrentPolicy: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_POLICY) as WebTorrentPolicyType, 91 webTorrentEnabled: peertubeLocalStorage.getItem(this.KEYS.WEBTORRENT_ENABLED) === 'true',
93 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true' 92 autoPlayVideo: peertubeLocalStorage.getItem(this.KEYS.AUTO_PLAY_VIDEO) === 'true'
94 }, 93 },
95 Tokens.load() 94 Tokens.load()
@@ -104,7 +103,7 @@ export class AuthUser extends User {
104 peertubeLocalStorage.removeItem(this.KEYS.ID) 103 peertubeLocalStorage.removeItem(this.KEYS.ID)
105 peertubeLocalStorage.removeItem(this.KEYS.ROLE) 104 peertubeLocalStorage.removeItem(this.KEYS.ROLE)
106 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY) 105 peertubeLocalStorage.removeItem(this.KEYS.NSFW_POLICY)
107 peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_POLICY) 106 peertubeLocalStorage.removeItem(this.KEYS.WEBTORRENT_ENABLED)
108 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO) 107 peertubeLocalStorage.removeItem(this.KEYS.AUTO_PLAY_VIDEO)
109 peertubeLocalStorage.removeItem(this.KEYS.EMAIL) 108 peertubeLocalStorage.removeItem(this.KEYS.EMAIL)
110 Tokens.flush() 109 Tokens.flush()
@@ -142,7 +141,7 @@ export class AuthUser extends User {
142 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email) 141 peertubeLocalStorage.setItem(AuthUser.KEYS.EMAIL, this.email)
143 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString()) 142 peertubeLocalStorage.setItem(AuthUser.KEYS.ROLE, this.role.toString())
144 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString()) 143 peertubeLocalStorage.setItem(AuthUser.KEYS.NSFW_POLICY, this.nsfwPolicy.toString())
145 peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_POLICY, this.webTorrentPolicy.toString()) 144 peertubeLocalStorage.setItem(AuthUser.KEYS.WEBTORRENT_ENABLED, JSON.stringify(this.webTorrentEnabled))
146 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo)) 145 peertubeLocalStorage.setItem(AuthUser.KEYS.AUTO_PLAY_VIDEO, JSON.stringify(this.autoPlayVideo))
147 this.tokens.save() 146 this.tokens.save()
148 } 147 }