]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
Migrate to $localize
[github/Chocobozzz/PeerTube.git] / client / src / app / +signup / +verify-account / verify-account-ask-send-email / verify-account-ask-send-email.component.ts
index cfd471fa400eaeb210e5930475f9708643246759..b26581d2bae5cb59ec23e00df5e726a604e850ae 100644 (file)
@@ -1,10 +1,7 @@
 import { Component, OnInit } from '@angular/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Notifier, RedirectService } from '@app/core'
-import { ServerService } from '@app/core/server'
-import { FormReactive, UserService } from '@app/shared'
-import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
-import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
+import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
+import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
+import { ServerConfig } from '@shared/models'
 
 @Component({
   selector: 'my-verify-account-ask-send-email',
@@ -13,6 +10,7 @@ import { UserValidatorsService } from '@app/shared/forms/form-validators/user-va
 })
 
 export class VerifyAccountAskSendEmailComponent extends FormReactive implements OnInit {
+  private serverConfig: ServerConfig
 
   constructor (
     protected formValidatorService: FormValidatorService,
@@ -20,17 +18,20 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
     private userService: UserService,
     private serverService: ServerService,
     private notifier: Notifier,
-    private redirectService: RedirectService,
-    private i18n: I18n
-  ) {
+    private redirectService: RedirectService
+    ) {
     super()
   }
 
   get requiresEmailVerification () {
-    return this.serverService.getConfig().signup.requiresEmailVerification
+    return this.serverConfig.signup.requiresEmailVerification
   }
 
   ngOnInit () {
+    this.serverConfig = this.serverService.getTmpConfig()
+    this.serverService.getConfig()
+        .subscribe(config => this.serverConfig = config)
+
     this.buildForm({
       'verify-email-email': this.userValidatorsService.USER_EMAIL
     })
@@ -41,11 +42,7 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
     this.userService.askSendVerifyEmail(email)
       .subscribe(
         () => {
-          const message = this.i18n(
-            'An email with verification link will be sent to {{email}}.',
-            { email }
-          )
-          this.notifier.success(message)
+          this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
           this.redirectService.redirectToHomepage()
         },