Ver código fonte

add username information in profile settings

Rigel Kent 3 anos atrás
pai
commit
52a3f561f5

+ 2 - 1
client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html

@@ -2,7 +2,8 @@
 <div *ngIf="success" class="alert alert-success">{{ success }}</div>
 
 <div i18n class="current-email">
-  Your current email is <span class="email">{{ user.email }}</span>
+  Your current email is <span class="email">{{ user.email }}</span>.
+  It is never shown to the public.
 </div>
 
 <div i18n class="pending-email" *ngIf="user.pendingEmail">

+ 11 - 0
client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html

@@ -2,6 +2,17 @@
 
 <form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form">
 
+  <div class="form-group">
+    <label i18n for="user-name">User name</label>
+    <input
+      type="text" id="user-name" class="form-control"
+      formControlName="user-name"
+    >
+    <div class="text-muted" i18n>
+      People can find you @{{ user.username }}@{{ instanceHost }}
+    </div>
+  </div>
+
   <div class="form-group">
     <label i18n for="display-name">Display name</label>
     <input

+ 8 - 0
client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.scss

@@ -16,6 +16,14 @@ input[type=text] {
   display: block;
 }
 
+input#user-name {
+  border: none;
+
+  & + div {
+    padding-left: 15px;
+  }
+}
+
 input[type=submit] {
   @include peertube-button;
   @include orange-button;

+ 7 - 0
client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts

@@ -25,18 +25,25 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {
 
   ngOnInit () {
     this.buildForm({
+      'user-name': null,
       'display-name': USER_DISPLAY_NAME_REQUIRED_VALIDATOR,
       description: USER_DESCRIPTION_VALIDATOR
     })
+    this.form.controls['user-name'].disable()
 
     this.userInformationLoaded.subscribe(() => {
       this.form.patchValue({
+        'user-name': this.user.username,
         'display-name': this.user.account.displayName,
         description: this.user.account.description
       })
     })
   }
 
+  get instanceHost () {
+    return window.location.host
+  }
+
   updateMyProfile () {
     const displayName = this.form.value['display-name']
     const description = this.form.value['description'] || null