X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=inline;f=client%2Fsrc%2Fapp%2Fshared%2Fforms%2Freactive-file.component.ts;h=c3986838f549c1c18302d984c638546c043bf310;hb=f8b2c1b4f509c037b9650cca2c5befd21f056df3;hp=f5758b6439f0ec3239ae08e5f72752afd7cfb7c4;hpb=40e87e9ecc54e3513fb586928330a7855eb192c6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/forms/reactive-file.component.ts b/client/src/app/shared/forms/reactive-file.component.ts index f5758b643..c3986838f 100644 --- a/client/src/app/shared/forms/reactive-file.component.ts +++ b/client/src/app/shared/forms/reactive-file.component.ts @@ -1,6 +1,6 @@ import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ @@ -25,11 +25,12 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { @Output() fileChanged = new EventEmitter() allowedExtensionsMessage = '' + fileInputValue: any private file: File constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private i18n: I18n ) {} @@ -48,7 +49,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { const [ file ] = event.target.files if (file.size > this.maxFileSize) { - this.notificationsService.error(this.i18n('Error'), this.i18n('This file is too large.')) + this.notifier.error(this.i18n('This file is too large.')) return } @@ -63,6 +64,8 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { writeValue (file: any) { this.file = file + + if (!this.file) this.fileInputValue = null } registerOnChange (fn: (_: any) => void) {