aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/users/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-19 10:37:35 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit9b474844e85cce916370693cc24f53339a695570 (patch)
tree10b1148a7581a2754e336a144c085a05ce72a1db /shared/extra-utils/users/users.ts
parent32fe00138990627749da58ff9f845584013aa219 (diff)
downloadPeerTube-9b474844e85cce916370693cc24f53339a695570.tar.gz
PeerTube-9b474844e85cce916370693cc24f53339a695570.tar.zst
PeerTube-9b474844e85cce916370693cc24f53339a695570.zip
Add CLI plugins tests
Diffstat (limited to 'shared/extra-utils/users/users.ts')
-rw-r--r--shared/extra-utils/users/users.ts21
1 files changed, 12 insertions, 9 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts
index 5fa8cde0c..30ed1bf4a 100644
--- a/shared/extra-utils/users/users.ts
+++ b/shared/extra-utils/users/users.ts
@@ -6,6 +6,7 @@ import { UserRegister } from '../../models/users/user-register.model'
6import { UserRole } from '../../models/users/user-role' 6import { UserRole } from '../../models/users/user-role'
7import { ServerInfo } from '../server/servers' 7import { ServerInfo } from '../server/servers'
8import { userLogin } from './login' 8import { userLogin } from './login'
9import { UserUpdateMe } from '../../models/users'
9 10
10type CreateUserArgs = { url: string, 11type CreateUserArgs = { url: string,
11 accessToken: string, 12 accessToken: string,
@@ -224,19 +225,21 @@ function updateMyUser (options: {
224 displayName?: string 225 displayName?: string
225 description?: string 226 description?: string
226 videosHistoryEnabled?: boolean 227 videosHistoryEnabled?: boolean
228 theme?: string
227}) { 229}) {
228 const path = '/api/v1/users/me' 230 const path = '/api/v1/users/me'
229 231
230 const toSend = {} 232 const toSend: UserUpdateMe = {}
231 if (options.currentPassword !== undefined && options.currentPassword !== null) toSend['currentPassword'] = options.currentPassword 233 if (options.currentPassword !== undefined && options.currentPassword !== null) toSend.currentPassword = options.currentPassword
232 if (options.newPassword !== undefined && options.newPassword !== null) toSend['password'] = options.newPassword 234 if (options.newPassword !== undefined && options.newPassword !== null) toSend.password = options.newPassword
233 if (options.nsfwPolicy !== undefined && options.nsfwPolicy !== null) toSend['nsfwPolicy'] = options.nsfwPolicy 235 if (options.nsfwPolicy !== undefined && options.nsfwPolicy !== null) toSend.nsfwPolicy = options.nsfwPolicy
234 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend['autoPlayVideo'] = options.autoPlayVideo 236 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend.autoPlayVideo = options.autoPlayVideo
235 if (options.email !== undefined && options.email !== null) toSend['email'] = options.email 237 if (options.email !== undefined && options.email !== null) toSend.email = options.email
236 if (options.description !== undefined && options.description !== null) toSend['description'] = options.description 238 if (options.description !== undefined && options.description !== null) toSend.description = options.description
237 if (options.displayName !== undefined && options.displayName !== null) toSend['displayName'] = options.displayName 239 if (options.displayName !== undefined && options.displayName !== null) toSend.displayName = options.displayName
240 if (options.theme !== undefined && options.theme !== null) toSend.theme = options.theme
238 if (options.videosHistoryEnabled !== undefined && options.videosHistoryEnabled !== null) { 241 if (options.videosHistoryEnabled !== undefined && options.videosHistoryEnabled !== null) {
239 toSend['videosHistoryEnabled'] = options.videosHistoryEnabled 242 toSend.videosHistoryEnabled = options.videosHistoryEnabled
240 } 243 }
241 244
242 return makePutBodyRequest({ 245 return makePutBodyRequest({