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/+my-account/my-account-video-channels | |
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/+my-account/my-account-video-channels')
3 files changed, 16 insertions, 18 deletions
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts index 81608d837..a68f79b47 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-create.component.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
5 | import { VideoChannelCreate } from '../../../../../shared/models/videos' | 5 | import { VideoChannelCreate } from '../../../../../shared/models/videos' |
6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
7 | import { AuthService } from '@app/core' | ||
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
9 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 8 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
10 | import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' | 9 | import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' |
@@ -21,7 +20,7 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
21 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
22 | private authService: AuthService, | 21 | private authService: AuthService, |
23 | private videoChannelValidatorsService: VideoChannelValidatorsService, | 22 | private videoChannelValidatorsService: VideoChannelValidatorsService, |
24 | private notificationsService: NotificationsService, | 23 | private notifier: Notifier, |
25 | private router: Router, | 24 | private router: Router, |
26 | private videoChannelService: VideoChannelService, | 25 | private videoChannelService: VideoChannelService, |
27 | private i18n: I18n | 26 | private i18n: I18n |
@@ -56,8 +55,8 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
56 | this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe( | 55 | this.videoChannelService.createVideoChannel(videoChannelCreate).subscribe( |
57 | () => { | 56 | () => { |
58 | this.authService.refreshUserInformation() | 57 | this.authService.refreshUserInformation() |
59 | this.notificationsService.success( | 58 | |
60 | this.i18n('Success'), | 59 | this.notifier.success( |
61 | this.i18n('Video channel {{videoChannelName}} created.', { videoChannelName: videoChannelCreate.displayName }) | 60 | this.i18n('Video channel {{videoChannelName}} created.', { videoChannelName: videoChannelCreate.displayName }) |
62 | ) | 61 | ) |
63 | this.router.navigate([ '/my-account', 'video-channels' ]) | 62 | this.router.navigate([ '/my-account', 'video-channels' ]) |
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts index 5d43956f2..da4fb645a 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channel-update.component.ts | |||
@@ -1,12 +1,11 @@ | |||
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | 1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 4 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
5 | import { VideoChannelUpdate } from '../../../../../shared/models/videos' | 5 | import { VideoChannelUpdate } from '../../../../../shared/models/videos' |
6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 6 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
7 | import { Subscription } from 'rxjs' | 7 | import { Subscription } from 'rxjs' |
8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
9 | import { AuthService, ServerService } from '@app/core' | ||
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 10 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
12 | import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' | 11 | import { VideoChannelValidatorsService } from '@app/shared/forms/form-validators/video-channel-validators.service' |
@@ -26,7 +25,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
26 | protected formValidatorService: FormValidatorService, | 25 | protected formValidatorService: FormValidatorService, |
27 | private authService: AuthService, | 26 | private authService: AuthService, |
28 | private videoChannelValidatorsService: VideoChannelValidatorsService, | 27 | private videoChannelValidatorsService: VideoChannelValidatorsService, |
29 | private notificationsService: NotificationsService, | 28 | private notifier: Notifier, |
30 | private router: Router, | 29 | private router: Router, |
31 | private route: ActivatedRoute, | 30 | private route: ActivatedRoute, |
32 | private videoChannelService: VideoChannelService, | 31 | private videoChannelService: VideoChannelService, |
@@ -79,10 +78,11 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
79 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( | 78 | this.videoChannelService.updateVideoChannel(this.videoChannelToUpdate.name, videoChannelUpdate).subscribe( |
80 | () => { | 79 | () => { |
81 | this.authService.refreshUserInformation() | 80 | this.authService.refreshUserInformation() |
82 | this.notificationsService.success( | 81 | |
83 | this.i18n('Success'), | 82 | this.notifier.success( |
84 | this.i18n('Video channel {{videoChannelName}} updated.', { videoChannelName: videoChannelUpdate.displayName }) | 83 | this.i18n('Video channel {{videoChannelName}} updated.', { videoChannelName: videoChannelUpdate.displayName }) |
85 | ) | 84 | ) |
85 | |||
86 | this.router.navigate([ '/my-account', 'video-channels' ]) | 86 | this.router.navigate([ '/my-account', 'video-channels' ]) |
87 | }, | 87 | }, |
88 | 88 | ||
@@ -94,12 +94,12 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
94 | this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData) | 94 | this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData) |
95 | .subscribe( | 95 | .subscribe( |
96 | data => { | 96 | data => { |
97 | this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) | 97 | this.notifier.success(this.i18n('Avatar changed.')) |
98 | 98 | ||
99 | this.videoChannelToUpdate.updateAvatar(data.avatar) | 99 | this.videoChannelToUpdate.updateAvatar(data.avatar) |
100 | }, | 100 | }, |
101 | 101 | ||
102 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 102 | err => this.notifier.error(err.message) |
103 | ) | 103 | ) |
104 | } | 104 | } |
105 | 105 | ||
diff --git a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts index 6d1098865..0ab3e2067 100644 --- a/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts +++ b/client/src/app/+my-account/my-account-video-channels/my-account-video-channels.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { AuthService } from '../../core/auth' | 3 | import { AuthService } from '../../core/auth' |
4 | import { ConfirmService } from '../../core/confirm' | 4 | import { ConfirmService } from '../../core/confirm' |
5 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 5 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
@@ -20,7 +20,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
20 | 20 | ||
21 | constructor ( | 21 | constructor ( |
22 | private authService: AuthService, | 22 | private authService: AuthService, |
23 | private notificationsService: NotificationsService, | 23 | private notifier: Notifier, |
24 | private confirmService: ConfirmService, | 24 | private confirmService: ConfirmService, |
25 | private videoChannelService: VideoChannelService, | 25 | private videoChannelService: VideoChannelService, |
26 | private i18n: I18n | 26 | private i18n: I18n |
@@ -46,15 +46,14 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
46 | 46 | ||
47 | this.videoChannelService.removeVideoChannel(videoChannel) | 47 | this.videoChannelService.removeVideoChannel(videoChannel) |
48 | .subscribe( | 48 | .subscribe( |
49 | status => { | 49 | () => { |
50 | this.loadVideoChannels() | 50 | this.loadVideoChannels() |
51 | this.notificationsService.success( | 51 | this.notifier.success( |
52 | this.i18n('Success'), | ||
53 | this.i18n('Video channel {{videoChannelName}} deleted.', { videoChannelName: videoChannel.displayName }) | 52 | this.i18n('Video channel {{videoChannelName}} deleted.', { videoChannelName: videoChannel.displayName }) |
54 | ) | 53 | ) |
55 | }, | 54 | }, |
56 | 55 | ||
57 | error => this.notificationsService.error(this.i18n('Error'), error.message) | 56 | error => this.notifier.error(error.message) |
58 | ) | 57 | ) |
59 | } | 58 | } |
60 | 59 | ||