+
+ concat(
+ of(''),
+ this.form.get('displayName').valueChanges
+ ).pipe(pairwise())
+ .subscribe(([ oldValue, newValue ]) => this.onDisplayNameChange(oldValue, newValue))
+ }
+
+ isSameThanUsername () {
+ return this.username && this.username === this.form.value['name']
+ }
+
+ private onDisplayNameChange (oldDisplayName: string, newDisplayName: string) {
+ const name = this.form.value['name'] || ''
+
+ const newName = this.userService.getNewUsername(oldDisplayName, newDisplayName, name)
+ this.form.patchValue({ name: newName })