diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-19 16:04:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-19 17:26:52 +0100 |
commit | f8b2c1b4f509c037b9650cca2c5befd21f056df3 (patch) | |
tree | 89d278f9628d657e6aad1b1e15febaf8ff9fcfa9 /client/src/app/shared/user-subscription | |
parent | e0e665f0efa98f2701dd9f5529e99989680481ae (diff) | |
download | PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.gz PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.zst PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.zip |
Refractor notification service
Shorter name and use primeng component
Diffstat (limited to 'client/src/app/shared/user-subscription')
-rw-r--r-- | client/src/app/shared/user-subscription/subscribe-button.component.ts | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/client/src/app/shared/user-subscription/subscribe-button.component.ts b/client/src/app/shared/user-subscription/subscribe-button.component.ts index 9c8a15023..8f1754c7f 100644 --- a/client/src/app/shared/user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/user-subscription/subscribe-button.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' | 4 | import { UserSubscriptionService } from '@app/shared/user-subscription/user-subscription.service' |
5 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 5 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
6 | import { NotificationsService } from 'angular2-notifications' | ||
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { VideoService } from '@app/shared/video/video.service' | 7 | import { VideoService } from '@app/shared/video/video.service' |
9 | import { FeedFormat } from '../../../../../shared/models/feeds' | 8 | import { FeedFormat } from '../../../../../shared/models/feeds' |
@@ -23,7 +22,7 @@ export class SubscribeButtonComponent implements OnInit { | |||
23 | constructor ( | 22 | constructor ( |
24 | private authService: AuthService, | 23 | private authService: AuthService, |
25 | private router: Router, | 24 | private router: Router, |
26 | private notificationsService: NotificationsService, | 25 | private notifier: Notifier, |
27 | private userSubscriptionService: UserSubscriptionService, | 26 | private userSubscriptionService: UserSubscriptionService, |
28 | private i18n: I18n, | 27 | private i18n: I18n, |
29 | private videoService: VideoService | 28 | private videoService: VideoService |
@@ -43,7 +42,7 @@ export class SubscribeButtonComponent implements OnInit { | |||
43 | .subscribe( | 42 | .subscribe( |
44 | res => this.subscribed = res[this.uri], | 43 | res => this.subscribed = res[this.uri], |
45 | 44 | ||
46 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 45 | err => this.notifier.error(err.message) |
47 | ) | 46 | ) |
48 | } | 47 | } |
49 | } | 48 | } |
@@ -62,13 +61,13 @@ export class SubscribeButtonComponent implements OnInit { | |||
62 | () => { | 61 | () => { |
63 | this.subscribed = true | 62 | this.subscribed = true |
64 | 63 | ||
65 | this.notificationsService.success( | 64 | this.notifier.success( |
66 | this.i18n('Subscribed'), | 65 | this.i18n('Subscribed to {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }), |
67 | this.i18n('Subscribed to {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }) | 66 | this.i18n('Subscribed') |
68 | ) | 67 | ) |
69 | }, | 68 | }, |
70 | 69 | ||
71 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 70 | err => this.notifier.error(err.message) |
72 | ) | 71 | ) |
73 | } | 72 | } |
74 | 73 | ||
@@ -84,13 +83,13 @@ export class SubscribeButtonComponent implements OnInit { | |||
84 | () => { | 83 | () => { |
85 | this.subscribed = false | 84 | this.subscribed = false |
86 | 85 | ||
87 | this.notificationsService.success( | 86 | this.notifier.success( |
88 | this.i18n('Unsubscribed'), | 87 | this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }), |
89 | this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannel.displayName }) | 88 | this.i18n('Unsubscribed') |
90 | ) | 89 | ) |
91 | }, | 90 | }, |
92 | 91 | ||
93 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 92 | err => this.notifier.error(err.message) |
94 | ) | 93 | ) |
95 | } | 94 | } |
96 | 95 | ||