RED-4418: show change language only on dev
This commit is contained in:
parent
895990d7ae
commit
e6167509ae
@ -15,7 +15,8 @@
|
|||||||
<label translate="user-profile-screen.form.last-name"></label>
|
<label translate="user-profile-screen.form.last-name"></label>
|
||||||
<input formControlName="lastName" name="lastName" type="text" />
|
<input formControlName="lastName" name="lastName" type="text" />
|
||||||
</div>
|
</div>
|
||||||
<div class="iqser-input-group">
|
|
||||||
|
<div *ngIf="userPreferences.areDevFeaturesEnabled" class="iqser-input-group">
|
||||||
<label translate="top-bar.navigation-items.my-account.children.language.label"></label>
|
<label translate="top-bar.navigation-items.my-account.children.language.label"></label>
|
||||||
<mat-select formControlName="language">
|
<mat-select formControlName="language">
|
||||||
<mat-option *ngFor="let language of languages" [value]="language">
|
<mat-option *ngFor="let language of languages" [value]="language">
|
||||||
@ -23,6 +24,7 @@
|
|||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="iqser-input-group">
|
<div class="iqser-input-group">
|
||||||
<a [href]="changePasswordUrl" target="_blank"> {{ 'user-profile-screen.actions.change-password' | translate }}</a>
|
<a [href]="changePasswordUrl" target="_blank"> {{ 'user-profile-screen.actions.change-password' | translate }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { UserService } from '@services/user.service';
|
|||||||
import { ConfigService } from '@services/config.service';
|
import { ConfigService } from '@services/config.service';
|
||||||
import { LanguageService } from '../../../../../i18n/language.service';
|
import { LanguageService } from '../../../../../i18n/language.service';
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { UserPreferenceService } from '../../../../../services/user-preference.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-user-profile-screen',
|
selector: 'redaction-user-profile-screen',
|
||||||
@ -18,30 +19,29 @@ import { firstValueFrom } from 'rxjs';
|
|||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class UserProfileScreenComponent extends BaseFormComponent implements OnInit {
|
export class UserProfileScreenComponent extends BaseFormComponent implements OnInit {
|
||||||
changePasswordUrl: SafeResourceUrl;
|
readonly changePasswordUrl: SafeResourceUrl;
|
||||||
translations = languagesTranslations;
|
readonly translations = languagesTranslations;
|
||||||
|
|
||||||
private _profileModel: IProfile;
|
#profileModel: IProfile;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly permissionsService: PermissionsService,
|
domSanitizer: DomSanitizer,
|
||||||
private readonly _formBuilder: UntypedFormBuilder,
|
configService: ConfigService,
|
||||||
private readonly _userService: UserService,
|
private readonly _userService: UserService,
|
||||||
private readonly _configService: ConfigService,
|
readonly permissionsService: PermissionsService,
|
||||||
private readonly _languageService: LanguageService,
|
readonly userPreferences: UserPreferenceService,
|
||||||
private readonly _domSanitizer: DomSanitizer,
|
|
||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
|
private readonly _formBuilder: UntypedFormBuilder,
|
||||||
|
private readonly _languageService: LanguageService,
|
||||||
protected readonly _translateService: TranslateService,
|
protected readonly _translateService: TranslateService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._loadingService.start();
|
this._loadingService.start();
|
||||||
this.changePasswordUrl = this._domSanitizer.bypassSecurityTrustResourceUrl(
|
this.changePasswordUrl = domSanitizer.bypassSecurityTrustResourceUrl(`${configService.values.OAUTH_URL}/account/password`);
|
||||||
`${this._configService.values.OAUTH_URL}/account/password`,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get languageChanged(): boolean {
|
get languageChanged(): boolean {
|
||||||
return this._profileModel['language'] !== this.form.get('language').value;
|
return this.#profileModel['language'] !== this.form.get('language').value;
|
||||||
}
|
}
|
||||||
|
|
||||||
get profileChanged(): boolean {
|
get profileChanged(): boolean {
|
||||||
@ -49,7 +49,7 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
|
|||||||
keys.splice(keys.indexOf('language'), 1);
|
keys.splice(keys.indexOf('language'), 1);
|
||||||
|
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
if (this._profileModel[key] !== this.form.get(key).value) {
|
if (this.#profileModel[key] !== this.form.get(key).value) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
|
|||||||
private _initializeForm(): void {
|
private _initializeForm(): void {
|
||||||
try {
|
try {
|
||||||
this.form = this._getForm();
|
this.form = this._getForm();
|
||||||
this._profileModel = {
|
this.#profileModel = {
|
||||||
email: this._userService.currentUser.email,
|
email: this._userService.currentUser.email,
|
||||||
firstName: this._userService.currentUser.firstName,
|
firstName: this._userService.currentUser.firstName,
|
||||||
lastName: this._userService.currentUser.lastName,
|
lastName: this._userService.currentUser.lastName,
|
||||||
@ -111,7 +111,7 @@ export class UserProfileScreenComponent extends BaseFormComponent implements OnI
|
|||||||
// disable email if it's already set
|
// disable email if it's already set
|
||||||
this.form.get('email').disable();
|
this.form.get('email').disable();
|
||||||
}
|
}
|
||||||
this.form.patchValue(this._profileModel, { emitEvent: false });
|
this.form.patchValue(this.#profileModel, { emitEvent: false });
|
||||||
this.initialFormValue = this.form.getRawValue();
|
this.initialFormValue = this.form.getRawValue();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user