aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-08-28 14:40:06 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-09-05 10:17:02 +0200
commit43d0ea7f4b88d52097172cc0c1831edd7e492503 (patch)
treed950f0a365bc1d7086992a686a06c335e14a9be9 /shared
parentbc20aaed463b1fc6727a2a90a7d7c4a00b95142a (diff)
downloadPeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.tar.gz
PeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.tar.zst
PeerTube-43d0ea7f4b88d52097172cc0c1831edd7e492503.zip
Add welcome modal
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/users/users.ts29
-rw-r--r--shared/models/users/user-update-me.model.ts3
-rw-r--r--shared/models/users/user.model.ts10
3 files changed, 14 insertions, 28 deletions
diff --git a/shared/extra-utils/users/users.ts b/shared/extra-utils/users/users.ts
index 30ed1bf4a..9959fd074 100644
--- a/shared/extra-utils/users/users.ts
+++ b/shared/extra-utils/users/users.ts
@@ -1,12 +1,12 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../requests/requests' 2import { makePostBodyRequest, makePutBodyRequest, updateAvatarRequest } from '../requests/requests'
3import { NSFWPolicyType } from '../../models/videos/nsfw-policy.type'
4import { UserAdminFlag } from '../../models/users/user-flag.model' 3import { UserAdminFlag } from '../../models/users/user-flag.model'
5import { UserRegister } from '../../models/users/user-register.model' 4import { UserRegister } from '../../models/users/user-register.model'
6import { UserRole } from '../../models/users/user-role' 5import { UserRole } from '../../models/users/user-role'
7import { ServerInfo } from '../server/servers' 6import { ServerInfo } from '../server/servers'
8import { userLogin } from './login' 7import { userLogin } from './login'
9import { UserUpdateMe } from '../../models/users' 8import { UserUpdateMe } from '../../models/users'
9import { omit } from 'lodash'
10 10
11type CreateUserArgs = { url: string, 11type CreateUserArgs = { url: string,
12 accessToken: string, 12 accessToken: string,
@@ -214,33 +214,10 @@ function unblockUser (url: string, userId: number | string, accessToken: string,
214 .expect(expectedStatus) 214 .expect(expectedStatus)
215} 215}
216 216
217function updateMyUser (options: { 217function updateMyUser (options: { url: string, accessToken: string } & UserUpdateMe) {
218 url: string
219 accessToken: string
220 currentPassword?: string
221 newPassword?: string
222 nsfwPolicy?: NSFWPolicyType
223 email?: string
224 autoPlayVideo?: boolean
225 displayName?: string
226 description?: string
227 videosHistoryEnabled?: boolean
228 theme?: string
229}) {
230 const path = '/api/v1/users/me' 218 const path = '/api/v1/users/me'
231 219
232 const toSend: UserUpdateMe = {} 220 const toSend: UserUpdateMe = omit(options, 'url', 'accessToken')
233 if (options.currentPassword !== undefined && options.currentPassword !== null) toSend.currentPassword = options.currentPassword
234 if (options.newPassword !== undefined && options.newPassword !== null) toSend.password = options.newPassword
235 if (options.nsfwPolicy !== undefined && options.nsfwPolicy !== null) toSend.nsfwPolicy = options.nsfwPolicy
236 if (options.autoPlayVideo !== undefined && options.autoPlayVideo !== null) toSend.autoPlayVideo = options.autoPlayVideo
237 if (options.email !== undefined && options.email !== null) toSend.email = options.email
238 if (options.description !== undefined && options.description !== null) toSend.description = options.description
239 if (options.displayName !== undefined && options.displayName !== null) toSend.displayName = options.displayName
240 if (options.theme !== undefined && options.theme !== null) toSend.theme = options.theme
241 if (options.videosHistoryEnabled !== undefined && options.videosHistoryEnabled !== null) {
242 toSend.videosHistoryEnabled = options.videosHistoryEnabled
243 }
244 221
245 return makePutBodyRequest({ 222 return makePutBodyRequest({
246 url: options.url, 223 url: options.url,
diff --git a/shared/models/users/user-update-me.model.ts b/shared/models/users/user-update-me.model.ts
index b6c0002e5..99b9a65bd 100644
--- a/shared/models/users/user-update-me.model.ts
+++ b/shared/models/users/user-update-me.model.ts
@@ -15,4 +15,7 @@ export interface UserUpdateMe {
15 password?: string 15 password?: string
16 16
17 theme?: string 17 theme?: string
18
19 noInstanceConfigWarningModal?: boolean
20 noWelcomeModal?: boolean
18} 21}
diff --git a/shared/models/users/user.model.ts b/shared/models/users/user.model.ts
index de9825e1f..f67d262b0 100644
--- a/shared/models/users/user.model.ts
+++ b/shared/models/users/user.model.ts
@@ -10,6 +10,7 @@ export interface User {
10 username: string 10 username: string
11 email: string 11 email: string
12 pendingEmail: string | null 12 pendingEmail: string | null
13
13 emailVerified: boolean 14 emailVerified: boolean
14 nsfwPolicy: NSFWPolicyType 15 nsfwPolicy: NSFWPolicyType
15 16
@@ -18,13 +19,15 @@ export interface User {
18 autoPlayVideo: boolean 19 autoPlayVideo: boolean
19 webTorrentEnabled: boolean 20 webTorrentEnabled: boolean
20 videosHistoryEnabled: boolean 21 videosHistoryEnabled: boolean
22 videoLanguages: string[]
21 23
22 role: UserRole 24 role: UserRole
23 roleLabel: string 25 roleLabel: string
24 26
25 videoQuota: number 27 videoQuota: number
26 videoQuotaDaily: number 28 videoQuotaDaily: number
27 createdAt: Date 29 videoQuotaUsed?: number
30 videoQuotaUsedDaily?: number
28 31
29 theme: string 32 theme: string
30 33
@@ -35,5 +38,8 @@ export interface User {
35 blocked: boolean 38 blocked: boolean
36 blockedReason?: string 39 blockedReason?: string
37 40
38 videoQuotaUsed?: number 41 noInstanceConfigWarningModal: boolean
42 noWelcomeModal: boolean
43
44 createdAt: Date
39} 45}