aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-26 10:03:40 +0200
committerChocobozzz <me@florianbigard.com>2018-04-26 10:03:40 +0200
commited56ad1193bb5bb0a81fb843a11eb90d3fed9861 (patch)
tree64842447b4721978c69e1d2b3a964951c789c408 /client/src/app/shared
parentd62cf3234ccfca0223a9639782635f0fb6594f8c (diff)
downloadPeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.tar.gz
PeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.tar.zst
PeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.zip
Add ability to update the user display name/description
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/forms/form-validators/user.ts24
-rw-r--r--client/src/app/shared/users/user.service.ts4
2 files changed, 26 insertions, 2 deletions
diff --git a/client/src/app/shared/forms/form-validators/user.ts b/client/src/app/shared/forms/form-validators/user.ts
index d2a28a272..095b534c0 100644
--- a/client/src/app/shared/forms/form-validators/user.ts
+++ b/client/src/app/shared/forms/form-validators/user.ts
@@ -46,3 +46,27 @@ export const USER_ROLE = {
46 'required': 'User role is required.' 46 'required': 'User role is required.'
47 } 47 }
48} 48}
49export const USER_DISPLAY_NAME = {
50 VALIDATORS: [
51 Validators.required,
52 Validators.minLength(3),
53 Validators.maxLength(120)
54 ],
55 MESSAGES: {
56 'required': 'Display name is required.',
57 'minlength': 'Display name must be at least 3 characters long.',
58 'maxlength': 'Display name cannot be more than 120 characters long.'
59 }
60}
61export const USER_DESCRIPTION = {
62 VALIDATORS: [
63 Validators.required,
64 Validators.minLength(3),
65 Validators.maxLength(250)
66 ],
67 MESSAGES: {
68 'required': 'Display name is required.',
69 'minlength': 'Display name must be at least 3 characters long.',
70 'maxlength': 'Display name cannot be more than 250 characters long.'
71 }
72}
diff --git a/client/src/app/shared/users/user.service.ts b/client/src/app/shared/users/user.service.ts
index da7b583f4..adb840cec 100644
--- a/client/src/app/shared/users/user.service.ts
+++ b/client/src/app/shared/users/user.service.ts
@@ -26,10 +26,10 @@ export class UserService {
26 .catch(res => this.restExtractor.handleError(res)) 26 .catch(res => this.restExtractor.handleError(res))
27 } 27 }
28 28
29 updateMyDetails (details: UserUpdateMe) { 29 updateMyProfile (profile: UserUpdateMe) {
30 const url = UserService.BASE_USERS_URL + 'me' 30 const url = UserService.BASE_USERS_URL + 'me'
31 31
32 return this.authHttp.put(url, details) 32 return this.authHttp.put(url, profile)
33 .map(this.restExtractor.extractDataBool) 33 .map(this.restExtractor.extractDataBool)
34 .catch(res => this.restExtractor.handleError(res)) 34 .catch(res => this.restExtractor.handleError(res))
35 } 35 }