From f8b2c1b4f509c037b9650cca2c5befd21f056df3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Dec 2018 16:04:34 +0100 Subject: Refractor notification service Shorter name and use primeng component --- .../app/videos/+video-watch/modal/video-blacklist.component.ts | 9 ++++----- .../app/videos/+video-watch/modal/video-download.component.ts | 6 +++--- .../src/app/videos/+video-watch/modal/video-report.component.ts | 8 ++++---- .../src/app/videos/+video-watch/modal/video-share.component.ts | 6 +++--- 4 files changed, 14 insertions(+), 15 deletions(-) (limited to 'client/src/app/videos/+video-watch/modal') diff --git a/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts b/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts index 2c123ebed..357ce39ce 100644 --- a/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-blacklist.component.ts @@ -1,12 +1,11 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier, RedirectService } from '@app/core' import { FormReactive, VideoBlacklistService, VideoBlacklistValidatorsService } from '../../../shared/index' import { VideoDetails } from '../../../shared/video/video-details.model' import { I18n } from '@ngx-translate/i18n-polyfill' import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' -import { RedirectService } from '@app/core' @Component({ selector: 'my-video-blacklist', @@ -27,7 +26,7 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { private modalService: NgbModal, private videoBlacklistValidatorsService: VideoBlacklistValidatorsService, private videoBlacklistService: VideoBlacklistService, - private notificationsService: NotificationsService, + private notifier: Notifier, private redirectService: RedirectService, private i18n: I18n ) { @@ -55,12 +54,12 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { this.videoBlacklistService.blacklistVideo(this.video.id, reason) .subscribe( () => { - this.notificationsService.success(this.i18n('Success'), this.i18n('Video blacklisted.')) + this.notifier.success(this.i18n('Video blacklisted.')) this.hide() this.redirectService.redirectToHomepage() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } } diff --git a/client/src/app/videos/+video-watch/modal/video-download.component.ts b/client/src/app/videos/+video-watch/modal/video-download.component.ts index b1b2c0623..834385771 100644 --- a/client/src/app/videos/+video-watch/modal/video-download.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-download.component.ts @@ -2,7 +2,7 @@ import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core' import { VideoDetails } from '../../../shared/video/video-details.model' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { I18n } from '@ngx-translate/i18n-polyfill' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' @Component({ selector: 'my-video-download', @@ -18,7 +18,7 @@ export class VideoDownloadComponent implements OnInit { resolutionId: number | string = -1 constructor ( - private notificationsService: NotificationsService, + private notifier: Notifier, private modalService: NgbModal, private i18n: I18n ) { } @@ -63,6 +63,6 @@ export class VideoDownloadComponent implements OnInit { } activateCopiedMessage () { - this.notificationsService.success(this.i18n('Success'), this.i18n('Copied')) + this.notifier.success(this.i18n('Copied')) } } diff --git a/client/src/app/videos/+video-watch/modal/video-report.component.ts b/client/src/app/videos/+video-watch/modal/video-report.component.ts index 023387984..911f3b447 100644 --- a/client/src/app/videos/+video-watch/modal/video-report.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-report.component.ts @@ -1,5 +1,5 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { FormReactive, VideoAbuseService } from '../../../shared/index' import { VideoDetails } from '../../../shared/video/video-details.model' import { I18n } from '@ngx-translate/i18n-polyfill' @@ -27,7 +27,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { private modalService: NgbModal, private videoAbuseValidatorsService: VideoAbuseValidatorsService, private videoAbuseService: VideoAbuseService, - private notificationsService: NotificationsService, + private notifier: Notifier, private i18n: I18n ) { super() @@ -66,11 +66,11 @@ export class VideoReportComponent extends FormReactive implements OnInit { this.videoAbuseService.reportVideo(this.video.id, reason) .subscribe( () => { - this.notificationsService.success(this.i18n('Success'), this.i18n('Video reported.')) + this.notifier.success(this.i18n('Video reported.')) this.hide() }, - err => this.notificationsService.error(this.i18n('Error'), err.message) + err => this.notifier.error(err.message) ) } diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts index 17e2b31e1..c6205e355 100644 --- a/client/src/app/videos/+video-watch/modal/video-share.component.ts +++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts @@ -1,5 +1,5 @@ import { Component, ElementRef, Input, ViewChild } from '@angular/core' -import { NotificationsService } from 'angular2-notifications' +import { Notifier } from '@app/core' import { VideoDetails } from '../../../shared/video/video-details.model' import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' import { I18n } from '@ngx-translate/i18n-polyfill' @@ -23,7 +23,7 @@ export class VideoShareComponent { constructor ( private modalService: NgbModal, - private notificationsService: NotificationsService, + private notifier: Notifier, private i18n: I18n ) { } @@ -49,7 +49,7 @@ export class VideoShareComponent { } activateCopiedMessage () { - this.notificationsService.success(this.i18n('Success'), this.i18n('Copied')) + this.notifier.success(this.i18n('Copied')) } getStartCheckboxLabel () { -- cgit v1.2.3