diff options
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/users/users.ts | 21 |
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' | |||
6 | import { UserRole } from '../../models/users/user-role' | 6 | import { UserRole } from '../../models/users/user-role' |
7 | import { ServerInfo } from '../server/servers' | 7 | import { ServerInfo } from '../server/servers' |
8 | import { userLogin } from './login' | 8 | import { userLogin } from './login' |
9 | import { UserUpdateMe } from '../../models/users' | ||
9 | 10 | ||
10 | type CreateUserArgs = { url: string, | 11 | type 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({ |