diff options
author | Andréas Livet <andreas.livet@gmail.com> | 2017-12-19 10:45:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-19 10:45:49 +0100 |
commit | 7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd (patch) | |
tree | 56116e7e9f8467b78ed6dfc81827288915d31c8c /server/controllers/api/users.ts | |
parent | 228077efd73485a2832bb6211c9fa923158c2112 (diff) | |
download | PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.gz PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.tar.zst PeerTube-7efe153b0bc23e596d5019b9fb3e3e32b6cfeccd.zip |
Enh #106 : Add an autoPlayVideo user attribute (#159)
Warning : I was not able to run the tests on my machine. It uses a different approach to handle databse connexion and didn't find where to configure it...
- create a migration file to add a boolean column in user table
- add autoPlayVideo attribute everywhere it is needed (both on client and server side)
- add tests
- add a way to configure this attribute in account-settings
- use the attribute in video-watch component to actually autoplay or not the video
Diffstat (limited to 'server/controllers/api/users.ts')
-rw-r--r-- | server/controllers/api/users.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/server/controllers/api/users.ts b/server/controllers/api/users.ts index d6c0e67f9..995542604 100644 --- a/server/controllers/api/users.ts +++ b/server/controllers/api/users.ts | |||
@@ -134,6 +134,7 @@ async function createUser (req: express.Request) { | |||
134 | password: body.password, | 134 | password: body.password, |
135 | email: body.email, | 135 | email: body.email, |
136 | displayNSFW: false, | 136 | displayNSFW: false, |
137 | autoPlayVideo: true, | ||
137 | role: body.role, | 138 | role: body.role, |
138 | videoQuota: body.videoQuota | 139 | videoQuota: body.videoQuota |
139 | }) | 140 | }) |
@@ -162,6 +163,7 @@ async function registerUser (req: express.Request) { | |||
162 | password: body.password, | 163 | password: body.password, |
163 | email: body.email, | 164 | email: body.email, |
164 | displayNSFW: false, | 165 | displayNSFW: false, |
166 | autoPlayVideo: true, | ||
165 | role: UserRole.USER, | 167 | role: UserRole.USER, |
166 | videoQuota: CONFIG.USER.VIDEO_QUOTA | 168 | videoQuota: CONFIG.USER.VIDEO_QUOTA |
167 | }) | 169 | }) |
@@ -219,6 +221,7 @@ async function updateMe (req: express.Request, res: express.Response, next: expr | |||
219 | if (body.password !== undefined) user.password = body.password | 221 | if (body.password !== undefined) user.password = body.password |
220 | if (body.email !== undefined) user.email = body.email | 222 | if (body.email !== undefined) user.email = body.email |
221 | if (body.displayNSFW !== undefined) user.displayNSFW = body.displayNSFW | 223 | if (body.displayNSFW !== undefined) user.displayNSFW = body.displayNSFW |
224 | if (body.autoPlayVideo !== undefined) user.autoPlayVideo = body.autoPlayVideo | ||
222 | 225 | ||
223 | await user.save() | 226 | await user.save() |
224 | 227 | ||