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 | |
parent | e0e665f0efa98f2701dd9f5529e99989680481ae (diff) | |
download | PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.gz PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.zst PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.zip |
Refractor notification service
Shorter name and use primeng component
78 files changed, 435 insertions, 476 deletions
diff --git a/client/package.json b/client/package.json index 62ae47184..81422f05f 100644 --- a/client/package.json +++ b/client/package.json | |||
@@ -97,7 +97,6 @@ | |||
97 | "@types/video.js": "^7.2.5", | 97 | "@types/video.js": "^7.2.5", |
98 | "@types/webtorrent": "^0.98.4", | 98 | "@types/webtorrent": "^0.98.4", |
99 | "angular2-hotkeys": "^2.1.2", | 99 | "angular2-hotkeys": "^2.1.2", |
100 | "angular2-notifications": "^1.0.2", | ||
101 | "awesome-typescript-loader": "5.2.1", | 100 | "awesome-typescript-loader": "5.2.1", |
102 | "bootstrap": "^4.1.3", | 101 | "bootstrap": "^4.1.3", |
103 | "buffer": "^5.1.0", | 102 | "buffer": "^5.1.0", |
diff --git a/client/src/app/+about/about-instance/about-instance.component.ts b/client/src/app/+about/about-instance/about-instance.component.ts index 354f52ce7..36e7a8e5b 100644 --- a/client/src/app/+about/about-instance/about-instance.component.ts +++ b/client/src/app/+about/about-instance/about-instance.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ServerService } from '@app/core' | 2 | import { Notifier, ServerService } from '@app/core' |
3 | import { MarkdownService } from '@app/videos/shared' | 3 | import { MarkdownService } from '@app/videos/shared' |
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | 5 | ||
7 | @Component({ | 6 | @Component({ |
@@ -9,14 +8,13 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
9 | templateUrl: './about-instance.component.html', | 8 | templateUrl: './about-instance.component.html', |
10 | styleUrls: [ './about-instance.component.scss' ] | 9 | styleUrls: [ './about-instance.component.scss' ] |
11 | }) | 10 | }) |
12 | |||
13 | export class AboutInstanceComponent implements OnInit { | 11 | export class AboutInstanceComponent implements OnInit { |
14 | shortDescription = '' | 12 | shortDescription = '' |
15 | descriptionHTML = '' | 13 | descriptionHTML = '' |
16 | termsHTML = '' | 14 | termsHTML = '' |
17 | 15 | ||
18 | constructor ( | 16 | constructor ( |
19 | private notificationsService: NotificationsService, | 17 | private notifier: Notifier, |
20 | private serverService: ServerService, | 18 | private serverService: ServerService, |
21 | private markdownService: MarkdownService, | 19 | private markdownService: MarkdownService, |
22 | private i18n: I18n | 20 | private i18n: I18n |
@@ -43,7 +41,7 @@ export class AboutInstanceComponent implements OnInit { | |||
43 | this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) | 41 | this.termsHTML = this.markdownService.textMarkdownToHTML(res.instance.terms) |
44 | }, | 42 | }, |
45 | 43 | ||
46 | err => this.notificationsService.error(this.i18n('Error getting about from server'), err) | 44 | () => this.notifier.error(this.i18n('Cannot get about information from server')) |
47 | ) | 45 | ) |
48 | } | 46 | } |
49 | 47 | ||
diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.ts index e5c1f58b0..13b634a01 100644 --- a/client/src/app/+accounts/account-videos/account-videos.component.ts +++ b/client/src/app/+accounts/account-videos/account-videos.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { Location } from '@angular/common' | 3 | import { Location } from '@angular/common' |
4 | import { immutableAssign } from '@app/shared/misc/utils' | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { ConfirmService } from '../../core/confirm' | 6 | import { ConfirmService } from '../../core/confirm' |
8 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -13,6 +12,7 @@ import { tap } from 'rxjs/operators' | |||
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 12 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Subscription } from 'rxjs' | 13 | import { Subscription } from 'rxjs' |
15 | import { ScreenService } from '@app/shared/misc/screen.service' | 14 | import { ScreenService } from '@app/shared/misc/screen.service' |
15 | import { Notifier } from '@app/core' | ||
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'my-account-videos', | 18 | selector: 'my-account-videos', |
@@ -35,7 +35,7 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit, | |||
35 | protected router: Router, | 35 | protected router: Router, |
36 | protected route: ActivatedRoute, | 36 | protected route: ActivatedRoute, |
37 | protected authService: AuthService, | 37 | protected authService: AuthService, |
38 | protected notificationsService: NotificationsService, | 38 | protected notifier: Notifier, |
39 | protected confirmService: ConfirmService, | 39 | protected confirmService: ConfirmService, |
40 | protected location: Location, | 40 | protected location: Location, |
41 | protected screenService: ScreenService, | 41 | protected screenService: ScreenService, |
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts index e19927d6b..036264602 100644 --- a/client/src/app/+accounts/accounts.component.ts +++ b/client/src/app/+accounts/accounts.component.ts | |||
@@ -5,10 +5,9 @@ import { Account } from '@app/shared/account/account.model' | |||
5 | import { RestExtractor, UserService } from '@app/shared' | 5 | import { RestExtractor, UserService } from '@app/shared' |
6 | import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' | 6 | import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' |
7 | import { Subscription } from 'rxjs' | 7 | import { Subscription } from 'rxjs' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { AuthService, Notifier, RedirectService } from '@app/core' |
9 | import { User, UserRight } from '../../../../shared' | 9 | import { User, UserRight } from '../../../../shared' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { AuthService, RedirectService } from '@app/core' | ||
12 | 11 | ||
13 | @Component({ | 12 | @Component({ |
14 | templateUrl: './accounts.component.html', | 13 | templateUrl: './accounts.component.html', |
@@ -24,7 +23,7 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
24 | private route: ActivatedRoute, | 23 | private route: ActivatedRoute, |
25 | private userService: UserService, | 24 | private userService: UserService, |
26 | private accountService: AccountService, | 25 | private accountService: AccountService, |
27 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
28 | private restExtractor: RestExtractor, | 27 | private restExtractor: RestExtractor, |
29 | private redirectService: RedirectService, | 28 | private redirectService: RedirectService, |
30 | private authService: AuthService, | 29 | private authService: AuthService, |
@@ -43,7 +42,7 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
43 | .subscribe( | 42 | .subscribe( |
44 | account => this.account = account, | 43 | account => this.account = account, |
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 | ||
@@ -69,7 +68,7 @@ export class AccountsComponent implements OnInit, OnDestroy { | |||
69 | .subscribe( | 68 | .subscribe( |
70 | user => this.user = user, | 69 | user => this.user = user, |
71 | 70 | ||
72 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 71 | err => this.notifier.error(err.message) |
73 | ) | 72 | ) |
74 | } | 73 | } |
75 | } | 74 | } |
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 6eea1cd76..ee877ee31 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core' | |||
2 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 2 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
3 | import { ServerService } from '@app/core/server/server.service' | 3 | import { ServerService } from '@app/core/server/server.service' |
4 | import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' | 4 | import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { Notifier } from '@app/core' |
6 | import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' | 6 | import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 8 | import { BuildFormDefaultValues, FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
@@ -25,7 +25,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
25 | protected formValidatorService: FormValidatorService, | 25 | protected formValidatorService: FormValidatorService, |
26 | private customConfigValidatorsService: CustomConfigValidatorsService, | 26 | private customConfigValidatorsService: CustomConfigValidatorsService, |
27 | private userValidatorsService: UserValidatorsService, | 27 | private userValidatorsService: UserValidatorsService, |
28 | private notificationsService: NotificationsService, | 28 | private notifier: Notifier, |
29 | private configService: ConfigService, | 29 | private configService: ConfigService, |
30 | private serverService: ServerService, | 30 | private serverService: ServerService, |
31 | private i18n: I18n | 31 | private i18n: I18n |
@@ -110,7 +110,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
110 | this.forceCheck() | 110 | this.forceCheck() |
111 | }, | 111 | }, |
112 | 112 | ||
113 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 113 | err => this.notifier.error(err.message) |
114 | ) | 114 | ) |
115 | } | 115 | } |
116 | 116 | ||
@@ -196,10 +196,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit { | |||
196 | 196 | ||
197 | this.updateForm() | 197 | this.updateForm() |
198 | 198 | ||
199 | this.notificationsService.success(this.i18n('Success'), this.i18n('Configuration updated.')) | 199 | this.notifier.success(this.i18n('Configuration updated.')) |
200 | }, | 200 | }, |
201 | 201 | ||
202 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 202 | err => this.notifier.error(err.message) |
203 | ) | 203 | ) |
204 | } | 204 | } |
205 | 205 | ||
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 43ce5d4af..9a8848bfb 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { SortMeta } from 'primeng/primeng' | 4 | import { SortMeta } from 'primeng/primeng' |
5 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' | 5 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' |
6 | import { RestPagination, RestTable } from '../../../shared' | 6 | import { RestPagination, RestTable } from '../../../shared' |
@@ -20,7 +20,7 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
23 | private notificationsService: NotificationsService, | 23 | private notifier: Notifier, |
24 | private followService: FollowService, | 24 | private followService: FollowService, |
25 | private i18n: I18n | 25 | private i18n: I18n |
26 | ) { | 26 | ) { |
@@ -39,7 +39,7 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
39 | this.totalRecords = resultList.total | 39 | this.totalRecords = resultList.total |
40 | }, | 40 | }, |
41 | 41 | ||
42 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 42 | err => this.notifier.error(err.message) |
43 | ) | 43 | ) |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts index bd9cc022b..2bb249746 100644 --- a/client/src/app/+admin/follows/following-add/following-add.component.ts +++ b/client/src/app/+admin/follows/following-add/following-add.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { ConfirmService } from '../../../core' | 4 | import { ConfirmService } from '../../../core' |
5 | import { validateHost } from '../../../shared' | 5 | import { validateHost } from '../../../shared' |
6 | import { FollowService } from '../shared' | 6 | import { FollowService } from '../shared' |
@@ -18,7 +18,7 @@ export class FollowingAddComponent { | |||
18 | 18 | ||
19 | constructor ( | 19 | constructor ( |
20 | private router: Router, | 20 | private router: Router, |
21 | private notificationsService: NotificationsService, | 21 | private notifier: Notifier, |
22 | private confirmService: ConfirmService, | 22 | private confirmService: ConfirmService, |
23 | private followService: FollowService, | 23 | private followService: FollowService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
@@ -64,12 +64,12 @@ export class FollowingAddComponent { | |||
64 | 64 | ||
65 | this.followService.follow(hosts).subscribe( | 65 | this.followService.follow(hosts).subscribe( |
66 | () => { | 66 | () => { |
67 | this.notificationsService.success(this.i18n('Success'), this.i18n('Follow request(s) sent!')) | 67 | this.notifier.success(this.i18n('Follow request(s) sent!')) |
68 | 68 | ||
69 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) | 69 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) |
70 | }, | 70 | }, |
71 | 71 | ||
72 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 72 | err => this.notifier.error(err.message) |
73 | ) | 73 | ) |
74 | } | 74 | } |
75 | 75 | ||
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index 9b7029f75..4517a721e 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.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 { SortMeta } from 'primeng/primeng' | 3 | import { SortMeta } from 'primeng/primeng' |
4 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' | 4 | import { ActorFollow } from '../../../../../../shared/models/actors/follow.model' |
5 | import { ConfirmService } from '../../../core/confirm/confirm.service' | 5 | import { ConfirmService } from '../../../core/confirm/confirm.service' |
@@ -20,7 +20,7 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
23 | private notificationsService: NotificationsService, | 23 | private notifier: Notifier, |
24 | private confirmService: ConfirmService, | 24 | private confirmService: ConfirmService, |
25 | private followService: FollowService, | 25 | private followService: FollowService, |
26 | private i18n: I18n | 26 | private i18n: I18n |
@@ -41,14 +41,11 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
41 | 41 | ||
42 | this.followService.unfollow(follow).subscribe( | 42 | this.followService.unfollow(follow).subscribe( |
43 | () => { | 43 | () => { |
44 | this.notificationsService.success( | 44 | this.notifier.success(this.i18n('You are not following {{host}} anymore.', { host: follow.following.host })) |
45 | this.i18n('Success'), | ||
46 | this.i18n('You are not following {{host}} anymore.', { host: follow.following.host }) | ||
47 | ) | ||
48 | this.loadData() | 45 | this.loadData() |
49 | }, | 46 | }, |
50 | 47 | ||
51 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 48 | err => this.notifier.error(err.message) |
52 | ) | 49 | ) |
53 | } | 50 | } |
54 | 51 | ||
@@ -60,7 +57,7 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
60 | this.totalRecords = resultList.total | 57 | this.totalRecords = resultList.total |
61 | }, | 58 | }, |
62 | 59 | ||
63 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 60 | err => this.notifier.error(err.message) |
64 | ) | 61 | ) |
65 | } | 62 | } |
66 | } | 63 | } |
diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts index 6d77a0eb4..fa1da26bf 100644 --- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts +++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service' | 4 | import { RedundancyService } from '@app/+admin/follows/shared/redundancy.service' |
5 | 5 | ||
@@ -13,24 +13,21 @@ export class RedundancyCheckboxComponent { | |||
13 | @Input() host: string | 13 | @Input() host: string |
14 | 14 | ||
15 | constructor ( | 15 | constructor ( |
16 | private notificationsService: NotificationsService, | 16 | private notifier: Notifier, |
17 | private redundancyService: RedundancyService, | 17 | private redundancyService: RedundancyService, |
18 | private i18n: I18n | 18 | private i18n: I18n |
19 | ) { } | 19 | ) { } |
20 | 20 | ||
21 | updateRedundancyState () { | 21 | updateRedundancyState () { |
22 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) | 22 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) |
23 | .subscribe( | 23 | .subscribe( |
24 | () => { | 24 | () => { |
25 | const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') | 25 | const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') |
26 | 26 | ||
27 | this.notificationsService.success( | 27 | this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel })) |
28 | this.i18n('Success'), | 28 | }, |
29 | this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel }) | ||
30 | ) | ||
31 | }, | ||
32 | 29 | ||
33 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 30 | err => this.notifier.error(err.message) |
34 | ) | 31 | ) |
35 | } | 32 | } |
36 | } | 33 | } |
diff --git a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts index 44778ab56..b265e1dd6 100644 --- a/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts +++ b/client/src/app/+admin/jobs/jobs-list/jobs-list.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 2 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { SortMeta } from 'primeng/primeng' | 4 | import { SortMeta } from 'primeng/primeng' |
5 | import { Job } from '../../../../../../shared/index' | 5 | import { Job } from '../../../../../../shared/index' |
6 | import { JobState } from '../../../../../../shared/models' | 6 | import { JobState } from '../../../../../../shared/models' |
@@ -25,7 +25,7 @@ export class JobsListComponent extends RestTable implements OnInit { | |||
25 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 25 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
26 | 26 | ||
27 | constructor ( | 27 | constructor ( |
28 | private notificationsService: NotificationsService, | 28 | private notifier: Notifier, |
29 | private jobsService: JobService, | 29 | private jobsService: JobService, |
30 | private i18n: I18n | 30 | private i18n: I18n |
31 | ) { | 31 | ) { |
@@ -53,7 +53,7 @@ export class JobsListComponent extends RestTable implements OnInit { | |||
53 | this.totalRecords = resultList.total | 53 | this.totalRecords = resultList.total |
54 | }, | 54 | }, |
55 | 55 | ||
56 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 56 | err => this.notifier.error(err.message) |
57 | ) | 57 | ) |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts index 3f243aee4..032bf745a 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-account-blocklist.component.ts | |||
@@ -1,9 +1,9 @@ | |||
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 { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { RestPagination, RestTable } from '@app/shared' | 4 | import { RestPagination, RestTable } from '@app/shared' |
5 | import { SortMeta } from 'primeng/components/common/sortmeta' | 5 | import { SortMeta } from 'primeng/components/common/sortmeta' |
6 | import { BlocklistService, AccountBlock } from '@app/shared/blocklist' | 6 | import { AccountBlock, BlocklistService } from '@app/shared/blocklist' |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'my-instance-account-blocklist', | 9 | selector: 'my-instance-account-blocklist', |
@@ -18,7 +18,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn | |||
18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
19 | 19 | ||
20 | constructor ( | 20 | constructor ( |
21 | private notificationsService: NotificationsService, | 21 | private notifier: Notifier, |
22 | private blocklistService: BlocklistService, | 22 | private blocklistService: BlocklistService, |
23 | private i18n: I18n | 23 | private i18n: I18n |
24 | ) { | 24 | ) { |
@@ -35,8 +35,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn | |||
35 | this.blocklistService.unblockAccountByInstance(blockedAccount) | 35 | this.blocklistService.unblockAccountByInstance(blockedAccount) |
36 | .subscribe( | 36 | .subscribe( |
37 | () => { | 37 | () => { |
38 | this.notificationsService.success( | 38 | this.notifier.success( |
39 | this.i18n('Success'), | ||
40 | this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost }) | 39 | this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost }) |
41 | ) | 40 | ) |
42 | 41 | ||
@@ -53,7 +52,7 @@ export class InstanceAccountBlocklistComponent extends RestTable implements OnIn | |||
53 | this.totalRecords = resultList.total | 52 | this.totalRecords = resultList.total |
54 | }, | 53 | }, |
55 | 54 | ||
56 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 55 | err => this.notifier.error(err.message) |
57 | ) | 56 | ) |
58 | } | 57 | } |
59 | } | 58 | } |
diff --git a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts index 130009dc7..db3dfcd1c 100644 --- a/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.component.ts +++ b/client/src/app/+admin/moderation/instance-blocklist/instance-server-blocklist.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 { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { RestPagination, RestTable } from '@app/shared' | 4 | import { RestPagination, RestTable } from '@app/shared' |
5 | import { SortMeta } from 'primeng/components/common/sortmeta' | 5 | import { SortMeta } from 'primeng/components/common/sortmeta' |
@@ -19,7 +19,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni | |||
19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
20 | 20 | ||
21 | constructor ( | 21 | constructor ( |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private blocklistService: BlocklistService, | 23 | private blocklistService: BlocklistService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { | 25 | ) { |
@@ -36,10 +36,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni | |||
36 | this.blocklistService.unblockServerByInstance(host) | 36 | this.blocklistService.unblockServerByInstance(host) |
37 | .subscribe( | 37 | .subscribe( |
38 | () => { | 38 | () => { |
39 | this.notificationsService.success( | 39 | this.notifier.success(this.i18n('Instance {{host}} unmuted by your instance.', { host })) |
40 | this.i18n('Success'), | ||
41 | this.i18n('Instance {{host}} unmuted by your instance.', { host }) | ||
42 | ) | ||
43 | 40 | ||
44 | this.loadData() | 41 | this.loadData() |
45 | } | 42 | } |
@@ -54,7 +51,7 @@ export class InstanceServerBlocklistComponent extends RestTable implements OnIni | |||
54 | this.totalRecords = resultList.total | 51 | this.totalRecords = resultList.total |
55 | }, | 52 | }, |
56 | 53 | ||
57 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 54 | err => this.notifier.error(err.message) |
58 | ) | 55 | ) |
59 | } | 56 | } |
60 | } | 57 | } |
diff --git a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts index 34ab384d1..bebcb4207 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/moderation-comment-modal.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared' | 3 | import { FormReactive, VideoAbuseService, VideoAbuseValidatorsService } from '../../../shared' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
@@ -22,7 +22,7 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
22 | constructor ( | 22 | constructor ( |
23 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
24 | private modalService: NgbModal, | 24 | private modalService: NgbModal, |
25 | private notificationsService: NotificationsService, | 25 | private notifier: Notifier, |
26 | private videoAbuseService: VideoAbuseService, | 26 | private videoAbuseService: VideoAbuseService, |
27 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, | 27 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, |
28 | private i18n: I18n | 28 | private i18n: I18n |
@@ -52,22 +52,19 @@ export class ModerationCommentModalComponent extends FormReactive implements OnI | |||
52 | } | 52 | } |
53 | 53 | ||
54 | async banUser () { | 54 | async banUser () { |
55 | const moderationComment: string = this.form.value['moderationComment'] | 55 | const moderationComment: string = this.form.value[ 'moderationComment' ] |
56 | 56 | ||
57 | this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment }) | 57 | this.videoAbuseService.updateVideoAbuse(this.abuseToComment, { moderationComment }) |
58 | .subscribe( | 58 | .subscribe( |
59 | () => { | 59 | () => { |
60 | this.notificationsService.success( | 60 | this.notifier.success(this.i18n('Comment updated.')) |
61 | this.i18n('Success'), | ||
62 | this.i18n('Comment updated.') | ||
63 | ) | ||
64 | 61 | ||
65 | this.commentUpdated.emit(moderationComment) | 62 | this.commentUpdated.emit(moderationComment) |
66 | this.hideModerationCommentModal() | 63 | this.hideModerationCommentModal() |
67 | }, | 64 | }, |
68 | 65 | ||
69 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 66 | err => this.notifier.error(err.message) |
70 | ) | 67 | ) |
71 | } | 68 | } |
72 | 69 | ||
73 | } | 70 | } |
diff --git a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts index 7a219c846..f64234b74 100644 --- a/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts +++ b/client/src/app/+admin/moderation/video-abuse-list/video-abuse-list.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { Account } from '../../../shared/account/account.model' | 2 | import { Account } from '../../../shared/account/account.model' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { SortMeta } from 'primeng/components/common/sortmeta' | 4 | import { SortMeta } from 'primeng/components/common/sortmeta' |
5 | import { VideoAbuse, VideoAbuseState } from '../../../../../../shared' | 5 | import { VideoAbuse, VideoAbuseState } from '../../../../../../shared' |
6 | import { RestPagination, RestTable, VideoAbuseService } from '../../../shared' | 6 | import { RestPagination, RestTable, VideoAbuseService } from '../../../shared' |
@@ -27,7 +27,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
27 | videoAbuseActions: DropdownAction<VideoAbuse>[] = [] | 27 | videoAbuseActions: DropdownAction<VideoAbuse>[] = [] |
28 | 28 | ||
29 | constructor ( | 29 | constructor ( |
30 | private notificationsService: NotificationsService, | 30 | private notifier: Notifier, |
31 | private videoAbuseService: VideoAbuseService, | 31 | private videoAbuseService: VideoAbuseService, |
32 | private confirmService: ConfirmService, | 32 | private confirmService: ConfirmService, |
33 | private i18n: I18n | 33 | private i18n: I18n |
@@ -90,14 +90,11 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
90 | 90 | ||
91 | this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe( | 91 | this.videoAbuseService.removeVideoAbuse(videoAbuse).subscribe( |
92 | () => { | 92 | () => { |
93 | this.notificationsService.success( | 93 | this.notifier.success(this.i18n('Abuse deleted.')) |
94 | this.i18n('Success'), | ||
95 | this.i18n('Abuse deleted.') | ||
96 | ) | ||
97 | this.loadData() | 94 | this.loadData() |
98 | }, | 95 | }, |
99 | 96 | ||
100 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 97 | err => this.notifier.error(err.message) |
101 | ) | 98 | ) |
102 | } | 99 | } |
103 | 100 | ||
@@ -106,7 +103,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
106 | .subscribe( | 103 | .subscribe( |
107 | () => this.loadData(), | 104 | () => this.loadData(), |
108 | 105 | ||
109 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 106 | err => this.notifier.error(err.message) |
110 | ) | 107 | ) |
111 | 108 | ||
112 | } | 109 | } |
@@ -119,7 +116,7 @@ export class VideoAbuseListComponent extends RestTable implements OnInit { | |||
119 | this.totalRecords = resultList.total | 116 | this.totalRecords = resultList.total |
120 | }, | 117 | }, |
121 | 118 | ||
122 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 119 | err => this.notifier.error(err.message) |
123 | ) | 120 | ) |
124 | } | 121 | } |
125 | } | 122 | } |
diff --git a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts index e491edaca..a02e84f67 100644 --- a/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts +++ b/client/src/app/+admin/moderation/video-blacklist-list/video-blacklist-list.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { SortMeta } from 'primeng/components/common/sortmeta' | 2 | import { SortMeta } from 'primeng/components/common/sortmeta' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { ConfirmService } from '../../../core' | 4 | import { ConfirmService } from '../../../core' |
5 | import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' | 5 | import { RestPagination, RestTable, VideoBlacklistService } from '../../../shared' |
6 | import { VideoBlacklist } from '../../../../../../shared' | 6 | import { VideoBlacklist } from '../../../../../../shared' |
@@ -23,7 +23,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
23 | videoBlacklistActions: DropdownAction<VideoBlacklist>[] = [] | 23 | videoBlacklistActions: DropdownAction<VideoBlacklist>[] = [] |
24 | 24 | ||
25 | constructor ( | 25 | constructor ( |
26 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
27 | private confirmService: ConfirmService, | 27 | private confirmService: ConfirmService, |
28 | private videoBlacklistService: VideoBlacklistService, | 28 | private videoBlacklistService: VideoBlacklistService, |
29 | private i18n: I18n | 29 | private i18n: I18n |
@@ -56,14 +56,11 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
56 | 56 | ||
57 | this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe( | 57 | this.videoBlacklistService.removeVideoFromBlacklist(entry.video.id).subscribe( |
58 | () => { | 58 | () => { |
59 | this.notificationsService.success( | 59 | this.notifier.success(this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name })) |
60 | this.i18n('Success'), | ||
61 | this.i18n('Video {{name}} removed from the blacklist.', { name: entry.video.name }) | ||
62 | ) | ||
63 | this.loadData() | 60 | this.loadData() |
64 | }, | 61 | }, |
65 | 62 | ||
66 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 63 | err => this.notifier.error(err.message) |
67 | ) | 64 | ) |
68 | } | 65 | } |
69 | 66 | ||
@@ -75,7 +72,7 @@ export class VideoBlacklistListComponent extends RestTable implements OnInit { | |||
75 | this.totalRecords = resultList.total | 72 | this.totalRecords = resultList.total |
76 | }, | 73 | }, |
77 | 74 | ||
78 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 75 | err => this.notifier.error(err.message) |
79 | ) | 76 | ) |
80 | } | 77 | } |
81 | } | 78 | } |
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts index dd8e4efd5..137ecfcbd 100644 --- a/client/src/app/+admin/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/users/user-edit/user-create.component.ts | |||
@@ -1,7 +1,6 @@ | |||
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 { Notifier, ServerService } from '@app/core' |
4 | import { ServerService } from '../../../core' | ||
5 | import { UserCreate, UserRole } from '../../../../../../shared' | 4 | import { UserCreate, UserRole } from '../../../../../../shared' |
6 | import { UserEdit } from './user-edit' | 5 | import { UserEdit } from './user-edit' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -24,7 +23,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
24 | protected configService: ConfigService, | 23 | protected configService: ConfigService, |
25 | private userValidatorsService: UserValidatorsService, | 24 | private userValidatorsService: UserValidatorsService, |
26 | private router: Router, | 25 | private router: Router, |
27 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
28 | private userService: UserService, | 27 | private userService: UserService, |
29 | private i18n: I18n | 28 | private i18n: I18n |
30 | ) { | 29 | ) { |
@@ -60,10 +59,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
60 | 59 | ||
61 | this.userService.addUser(userCreate).subscribe( | 60 | this.userService.addUser(userCreate).subscribe( |
62 | () => { | 61 | () => { |
63 | this.notificationsService.success( | 62 | this.notifier.success(this.i18n('User {{username}} created.', { username: userCreate.username })) |
64 | this.i18n('Success'), | ||
65 | this.i18n('User {{username}} created.', { username: userCreate.username }) | ||
66 | ) | ||
67 | this.router.navigate([ '/admin/users/list' ]) | 63 | this.router.navigate([ '/admin/users/list' ]) |
68 | }, | 64 | }, |
69 | 65 | ||
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts index cd3885a99..61e641823 100644 --- a/client/src/app/+admin/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/users/user-edit/user-update.component.ts | |||
@@ -1,7 +1,7 @@ | |||
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 { Subscription } from 'rxjs' | 3 | import { Subscription } from 'rxjs' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { Notifier } from '@app/core' |
5 | import { ServerService } from '../../../core' | 5 | import { ServerService } from '../../../core' |
6 | import { UserEdit } from './user-edit' | 6 | import { UserEdit } from './user-edit' |
7 | import { User, UserUpdate } from '../../../../../../shared' | 7 | import { User, UserUpdate } from '../../../../../../shared' |
@@ -30,7 +30,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
30 | private userValidatorsService: UserValidatorsService, | 30 | private userValidatorsService: UserValidatorsService, |
31 | private route: ActivatedRoute, | 31 | private route: ActivatedRoute, |
32 | private router: Router, | 32 | private router: Router, |
33 | private notificationsService: NotificationsService, | 33 | private notifier: Notifier, |
34 | private userService: UserService, | 34 | private userService: UserService, |
35 | private i18n: I18n | 35 | private i18n: I18n |
36 | ) { | 36 | ) { |
@@ -73,10 +73,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
73 | 73 | ||
74 | this.userService.updateUser(this.userId, userUpdate).subscribe( | 74 | this.userService.updateUser(this.userId, userUpdate).subscribe( |
75 | () => { | 75 | () => { |
76 | this.notificationsService.success( | 76 | this.notifier.success(this.i18n('User {{username}} updated.', { username: this.username })) |
77 | this.i18n('Success'), | ||
78 | this.i18n('User {{username}} updated.', { username: this.username }) | ||
79 | ) | ||
80 | this.router.navigate([ '/admin/users/list' ]) | 77 | this.router.navigate([ '/admin/users/list' ]) |
81 | }, | 78 | }, |
82 | 79 | ||
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index fb085c133..66ab796f9 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { ConfirmService, ServerService } from '../../../core' | 4 | import { ConfirmService, ServerService } from '../../../core' |
5 | import { RestPagination, RestTable, UserService } from '../../../shared' | 5 | import { RestPagination, RestTable, UserService } from '../../../shared' |
@@ -26,7 +26,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
26 | bulkUserActions: DropdownAction<User[]>[] = [] | 26 | bulkUserActions: DropdownAction<User[]>[] = [] |
27 | 27 | ||
28 | constructor ( | 28 | constructor ( |
29 | private notificationsService: NotificationsService, | 29 | private notifier: Notifier, |
30 | private confirmService: ConfirmService, | 30 | private confirmService: ConfirmService, |
31 | private serverService: ServerService, | 31 | private serverService: ServerService, |
32 | private userService: UserService, | 32 | private userService: UserService, |
@@ -68,7 +68,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
68 | openBanUserModal (users: User[]) { | 68 | openBanUserModal (users: User[]) { |
69 | for (const user of users) { | 69 | for (const user of users) { |
70 | if (user.username === 'root') { | 70 | if (user.username === 'root') { |
71 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) | 71 | this.notifier.error(this.i18n('You cannot ban root.')) |
72 | return | 72 | return |
73 | } | 73 | } |
74 | } | 74 | } |
@@ -91,18 +91,18 @@ export class UserListComponent extends RestTable implements OnInit { | |||
91 | () => { | 91 | () => { |
92 | const message = this.i18n('{{num}} users unbanned.', { num: users.length }) | 92 | const message = this.i18n('{{num}} users unbanned.', { num: users.length }) |
93 | 93 | ||
94 | this.notificationsService.success(this.i18n('Success'), message) | 94 | this.notifier.success(message) |
95 | this.loadData() | 95 | this.loadData() |
96 | }, | 96 | }, |
97 | 97 | ||
98 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 98 | err => this.notifier.error(err.message) |
99 | ) | 99 | ) |
100 | } | 100 | } |
101 | 101 | ||
102 | async removeUsers (users: User[]) { | 102 | async removeUsers (users: User[]) { |
103 | for (const user of users) { | 103 | for (const user of users) { |
104 | if (user.username === 'root') { | 104 | if (user.username === 'root') { |
105 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) | 105 | this.notifier.error(this.i18n('You cannot delete root.')) |
106 | return | 106 | return |
107 | } | 107 | } |
108 | } | 108 | } |
@@ -113,28 +113,22 @@ export class UserListComponent extends RestTable implements OnInit { | |||
113 | 113 | ||
114 | this.userService.removeUser(users).subscribe( | 114 | this.userService.removeUser(users).subscribe( |
115 | () => { | 115 | () => { |
116 | this.notificationsService.success( | 116 | this.notifier.success(this.i18n('{{num}} users deleted.', { num: users.length })) |
117 | this.i18n('Success'), | ||
118 | this.i18n('{{num}} users deleted.', { num: users.length }) | ||
119 | ) | ||
120 | this.loadData() | 117 | this.loadData() |
121 | }, | 118 | }, |
122 | 119 | ||
123 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 120 | err => this.notifier.error(err.message) |
124 | ) | 121 | ) |
125 | } | 122 | } |
126 | 123 | ||
127 | async setEmailsAsVerified (users: User[]) { | 124 | async setEmailsAsVerified (users: User[]) { |
128 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( | 125 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( |
129 | () => { | 126 | () => { |
130 | this.notificationsService.success( | 127 | this.notifier.success(this.i18n('{{num}} users email set as verified.', { num: users.length })) |
131 | this.i18n('Success'), | ||
132 | this.i18n('{{num}} users email set as verified.', { num: users.length }) | ||
133 | ) | ||
134 | this.loadData() | 128 | this.loadData() |
135 | }, | 129 | }, |
136 | 130 | ||
137 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 131 | err => this.notifier.error(err.message) |
138 | ) | 132 | ) |
139 | } | 133 | } |
140 | 134 | ||
@@ -146,13 +140,13 @@ export class UserListComponent extends RestTable implements OnInit { | |||
146 | this.selectedUsers = [] | 140 | this.selectedUsers = [] |
147 | 141 | ||
148 | this.userService.getUsers(this.pagination, this.sort, this.search) | 142 | this.userService.getUsers(this.pagination, this.sort, this.search) |
149 | .subscribe( | 143 | .subscribe( |
150 | resultList => { | 144 | resultList => { |
151 | this.users = resultList.data | 145 | this.users = resultList.data |
152 | this.totalRecords = resultList.total | 146 | this.totalRecords = resultList.total |
153 | }, | 147 | }, |
154 | 148 | ||
155 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 149 | err => this.notifier.error(err.message) |
156 | ) | 150 | ) |
157 | } | 151 | } |
158 | } | 152 | } |
diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts index fbad28410..e3025dec4 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-blocklist.component.ts | |||
@@ -1,9 +1,9 @@ | |||
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 { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { RestPagination, RestTable } from '@app/shared' | 4 | import { RestPagination, RestTable } from '@app/shared' |
5 | import { SortMeta } from 'primeng/components/common/sortmeta' | 5 | import { SortMeta } from 'primeng/components/common/sortmeta' |
6 | import { BlocklistService, AccountBlock } from '@app/shared/blocklist' | 6 | import { AccountBlock, BlocklistService } from '@app/shared/blocklist' |
7 | 7 | ||
8 | @Component({ | 8 | @Component({ |
9 | selector: 'my-account-blocklist', | 9 | selector: 'my-account-blocklist', |
@@ -18,7 +18,7 @@ export class MyAccountBlocklistComponent extends RestTable implements OnInit { | |||
18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 18 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
19 | 19 | ||
20 | constructor ( | 20 | constructor ( |
21 | private notificationsService: NotificationsService, | 21 | private notifier: Notifier, |
22 | private blocklistService: BlocklistService, | 22 | private blocklistService: BlocklistService, |
23 | private i18n: I18n | 23 | private i18n: I18n |
24 | ) { | 24 | ) { |
@@ -35,10 +35,7 @@ export class MyAccountBlocklistComponent extends RestTable implements OnInit { | |||
35 | this.blocklistService.unblockAccountByUser(blockedAccount) | 35 | this.blocklistService.unblockAccountByUser(blockedAccount) |
36 | .subscribe( | 36 | .subscribe( |
37 | () => { | 37 | () => { |
38 | this.notificationsService.success( | 38 | this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: blockedAccount.nameWithHost })) |
39 | this.i18n('Success'), | ||
40 | this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: blockedAccount.nameWithHost }) | ||
41 | ) | ||
42 | 39 | ||
43 | this.loadData() | 40 | this.loadData() |
44 | } | 41 | } |
@@ -53,7 +50,7 @@ export class MyAccountBlocklistComponent extends RestTable implements OnInit { | |||
53 | this.totalRecords = resultList.total | 50 | this.totalRecords = resultList.total |
54 | }, | 51 | }, |
55 | 52 | ||
56 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 53 | err => this.notifier.error(err.message) |
57 | ) | 54 | ) |
58 | } | 55 | } |
59 | } | 56 | } |
diff --git a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts index b411d6926..4c5cc28b8 100644 --- a/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.component.ts +++ b/client/src/app/+my-account/my-account-blocklist/my-account-server-blocklist.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 { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { RestPagination, RestTable } from '@app/shared' | 4 | import { RestPagination, RestTable } from '@app/shared' |
5 | import { SortMeta } from 'primeng/components/common/sortmeta' | 5 | import { SortMeta } from 'primeng/components/common/sortmeta' |
@@ -19,7 +19,7 @@ export class MyAccountServerBlocklistComponent extends RestTable implements OnIn | |||
19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
20 | 20 | ||
21 | constructor ( | 21 | constructor ( |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private blocklistService: BlocklistService, | 23 | private blocklistService: BlocklistService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { | 25 | ) { |
@@ -36,10 +36,7 @@ export class MyAccountServerBlocklistComponent extends RestTable implements OnIn | |||
36 | this.blocklistService.unblockServerByUser(host) | 36 | this.blocklistService.unblockServerByUser(host) |
37 | .subscribe( | 37 | .subscribe( |
38 | () => { | 38 | () => { |
39 | this.notificationsService.success( | 39 | this.notifier.success(this.i18n('Instance {{host}} unmuted.', { host })) |
40 | this.i18n('Success'), | ||
41 | this.i18n('Instance {{host}} unmuted.', { host }) | ||
42 | ) | ||
43 | 40 | ||
44 | this.loadData() | 41 | this.loadData() |
45 | } | 42 | } |
@@ -54,7 +51,7 @@ export class MyAccountServerBlocklistComponent extends RestTable implements OnIn | |||
54 | this.totalRecords = resultList.total | 51 | this.totalRecords = resultList.total |
55 | }, | 52 | }, |
56 | 53 | ||
57 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 54 | err => this.notifier.error(err.message) |
58 | ) | 55 | ) |
59 | } | 56 | } |
60 | } | 57 | } |
diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.ts b/client/src/app/+my-account/my-account-history/my-account-history.component.ts index 6ec4fefe8..394091bad 100644 --- a/client/src/app/+my-account/my-account-history/my-account-history.component.ts +++ b/client/src/app/+my-account/my-account-history/my-account-history.component.ts | |||
@@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { Location } from '@angular/common' | 3 | import { Location } from '@angular/common' |
4 | import { immutableAssign } from '@app/shared/misc/utils' | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
5 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 5 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
6 | import { NotificationsService } from 'angular2-notifications' | ||
7 | import { AuthService } from '../../core/auth' | 6 | import { AuthService } from '../../core/auth' |
8 | import { ConfirmService } from '../../core/confirm' | 7 | import { ConfirmService } from '../../core/confirm' |
9 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 8 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -12,6 +11,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
12 | import { ScreenService } from '@app/shared/misc/screen.service' | 11 | import { ScreenService } from '@app/shared/misc/screen.service' |
13 | import { UserHistoryService } from '@app/shared/users/user-history.service' | 12 | import { UserHistoryService } from '@app/shared/users/user-history.service' |
14 | import { UserService } from '@app/shared' | 13 | import { UserService } from '@app/shared' |
14 | import { Notifier } from '@app/core' | ||
15 | 15 | ||
16 | @Component({ | 16 | @Component({ |
17 | selector: 'my-account-history', | 17 | selector: 'my-account-history', |
@@ -36,7 +36,7 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
36 | protected route: ActivatedRoute, | 36 | protected route: ActivatedRoute, |
37 | protected authService: AuthService, | 37 | protected authService: AuthService, |
38 | protected userService: UserService, | 38 | protected userService: UserService, |
39 | protected notificationsService: NotificationsService, | 39 | protected notifier: Notifier, |
40 | protected location: Location, | 40 | protected location: Location, |
41 | protected screenService: ScreenService, | 41 | protected screenService: ScreenService, |
42 | protected i18n: I18n, | 42 | protected i18n: I18n, |
@@ -77,12 +77,12 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
77 | this.i18n('Videos history is enabled') : | 77 | this.i18n('Videos history is enabled') : |
78 | this.i18n('Videos history is disabled') | 78 | this.i18n('Videos history is disabled') |
79 | 79 | ||
80 | this.notificationsService.success(this.i18n('Success'), message) | 80 | this.notifier.success(message) |
81 | 81 | ||
82 | this.authService.refreshUserInformation() | 82 | this.authService.refreshUserInformation() |
83 | }, | 83 | }, |
84 | 84 | ||
85 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 85 | err => this.notifier.error(err.message) |
86 | ) | 86 | ) |
87 | } | 87 | } |
88 | 88 | ||
@@ -96,12 +96,12 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
96 | this.userHistoryService.deleteUserVideosHistory() | 96 | this.userHistoryService.deleteUserVideosHistory() |
97 | .subscribe( | 97 | .subscribe( |
98 | () => { | 98 | () => { |
99 | this.notificationsService.success(this.i18n('Success'), this.i18n('Videos history deleted')) | 99 | this.notifier.success(this.i18n('Videos history deleted')) |
100 | 100 | ||
101 | this.reloadVideos() | 101 | this.reloadVideos() |
102 | }, | 102 | }, |
103 | 103 | ||
104 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 104 | err => this.notifier.error(err.message) |
105 | ) | 105 | ) |
106 | } | 106 | } |
107 | } | 107 | } |
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts index a68b452ec..79d29b139 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { AuthService, Notifier } from '@app/core' |
3 | import { FormReactive } from '@app/shared' | 3 | import { FormReactive } from '@app/shared' |
4 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 4 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
5 | import { VideoOwnershipService } from '@app/shared/video-ownership' | 5 | import { VideoOwnershipService } from '@app/shared/video-ownership' |
@@ -8,7 +8,6 @@ import { VideoAcceptOwnershipValidatorsService } from '@app/shared/forms/form-va | |||
8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 8 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
9 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 9 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { AuthService } from '@app/core' | ||
12 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 11 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
13 | 12 | ||
14 | @Component({ | 13 | @Component({ |
@@ -31,7 +30,7 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
31 | protected formValidatorService: FormValidatorService, | 30 | protected formValidatorService: FormValidatorService, |
32 | private videoChangeOwnershipValidatorsService: VideoAcceptOwnershipValidatorsService, | 31 | private videoChangeOwnershipValidatorsService: VideoAcceptOwnershipValidatorsService, |
33 | private videoOwnershipService: VideoOwnershipService, | 32 | private videoOwnershipService: VideoOwnershipService, |
34 | private notificationsService: NotificationsService, | 33 | private notifier: Notifier, |
35 | private authService: AuthService, | 34 | private authService: AuthService, |
36 | private videoChannelService: VideoChannelService, | 35 | private videoChannelService: VideoChannelService, |
37 | private modalService: NgbModal, | 36 | private modalService: NgbModal, |
@@ -68,12 +67,12 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
68 | .acceptOwnership(videoChangeOwnership.id, { channelId: channel }) | 67 | .acceptOwnership(videoChangeOwnership.id, { channelId: channel }) |
69 | .subscribe( | 68 | .subscribe( |
70 | () => { | 69 | () => { |
71 | this.notificationsService.success(this.i18n('Success'), this.i18n('Ownership accepted')) | 70 | this.notifier.success(this.i18n('Ownership accepted')) |
72 | if (this.accepted) this.accepted.emit() | 71 | if (this.accepted) this.accepted.emit() |
73 | this.videoChangeOwnership = undefined | 72 | this.videoChangeOwnership = undefined |
74 | }, | 73 | }, |
75 | 74 | ||
76 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 75 | err => this.notifier.error(err.message) |
77 | ) | 76 | ) |
78 | } | 77 | } |
79 | } | 78 | } |
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts index 0b51ac13c..77857c4fd 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-ownership.component.ts | |||
@@ -1,13 +1,11 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | import { RestPagination, RestTable } from '@app/shared' | 3 | import { RestPagination, RestTable } from '@app/shared' |
5 | import { SortMeta } from 'primeng/components/common/sortmeta' | 4 | import { SortMeta } from 'primeng/components/common/sortmeta' |
6 | import { VideoChangeOwnership } from '../../../../../shared' | 5 | import { VideoChangeOwnership } from '../../../../../shared' |
7 | import { VideoOwnershipService } from '@app/shared/video-ownership' | 6 | import { VideoOwnershipService } from '@app/shared/video-ownership' |
8 | import { Account } from '@app/shared/account/account.model' | 7 | import { Account } from '@app/shared/account/account.model' |
9 | import { MyAccountAcceptOwnershipComponent } | 8 | import { MyAccountAcceptOwnershipComponent } from './my-account-accept-ownership/my-account-accept-ownership.component' |
10 | from '@app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component' | ||
11 | 9 | ||
12 | @Component({ | 10 | @Component({ |
13 | selector: 'my-account-ownership', | 11 | selector: 'my-account-ownership', |
@@ -23,9 +21,8 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { | |||
23 | @ViewChild('myAccountAcceptOwnershipComponent') myAccountAcceptOwnershipComponent: MyAccountAcceptOwnershipComponent | 21 | @ViewChild('myAccountAcceptOwnershipComponent') myAccountAcceptOwnershipComponent: MyAccountAcceptOwnershipComponent |
24 | 22 | ||
25 | constructor ( | 23 | constructor ( |
26 | private notificationsService: NotificationsService, | 24 | private notifier: Notifier, |
27 | private videoOwnershipService: VideoOwnershipService, | 25 | private videoOwnershipService: VideoOwnershipService |
28 | private i18n: I18n | ||
29 | ) { | 26 | ) { |
30 | super() | 27 | super() |
31 | } | 28 | } |
@@ -50,7 +47,7 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { | |||
50 | this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id) | 47 | this.videoOwnershipService.refuseOwnership(videoChangeOwnership.id) |
51 | .subscribe( | 48 | .subscribe( |
52 | () => this.loadData(), | 49 | () => this.loadData(), |
53 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 50 | err => this.notifier.error(err.message) |
54 | ) | 51 | ) |
55 | } | 52 | } |
56 | 53 | ||
@@ -62,7 +59,7 @@ export class MyAccountOwnershipComponent extends RestTable implements OnInit { | |||
62 | this.totalRecords = resultList.total | 59 | this.totalRecords = resultList.total |
63 | }, | 60 | }, |
64 | 61 | ||
65 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 62 | err => this.notifier.error(err.message) |
66 | ) | 63 | ) |
67 | } | 64 | } |
68 | } | 65 | } |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts index e5343b33d..cbb068c7c 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { AuthService, Notifier } from '@app/core' |
3 | import { FormReactive, UserService } from '../../../shared' | 3 | import { FormReactive, UserService } from '../../../shared' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 5 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
6 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | 6 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' |
7 | import { filter } from 'rxjs/operators' | 7 | import { filter } from 'rxjs/operators' |
8 | import { AuthService } from '@app/core' | ||
9 | import { User } from '../../../../../../shared' | 8 | import { User } from '../../../../../../shared' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -20,7 +19,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
20 | constructor ( | 19 | constructor ( |
21 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
22 | private userValidatorsService: UserValidatorsService, | 21 | private userValidatorsService: UserValidatorsService, |
23 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
24 | private authService: AuthService, | 23 | private authService: AuthService, |
25 | private userService: UserService, | 24 | private userService: UserService, |
26 | private i18n: I18n | 25 | private i18n: I18n |
@@ -50,7 +49,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
50 | 49 | ||
51 | this.userService.changePassword(currentPassword, newPassword).subscribe( | 50 | this.userService.changePassword(currentPassword, newPassword).subscribe( |
52 | () => { | 51 | () => { |
53 | this.notificationsService.success(this.i18n('Success'), this.i18n('Password updated.')) | 52 | this.notifier.success(this.i18n('Password updated.')) |
54 | 53 | ||
55 | this.form.reset() | 54 | this.form.reset() |
56 | this.error = null | 55 | this.error = null |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts index 63a121f64..3f79efe20 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { AuthService, ConfirmService, RedirectService } from '../../../core' | 3 | import { AuthService, ConfirmService, RedirectService } from '../../../core' |
4 | import { UserService } from '../../../shared' | 4 | import { UserService } from '../../../shared' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -15,7 +15,7 @@ export class MyAccountDangerZoneComponent { | |||
15 | 15 | ||
16 | constructor ( | 16 | constructor ( |
17 | private authService: AuthService, | 17 | private authService: AuthService, |
18 | private notificationsService: NotificationsService, | 18 | private notifier: Notifier, |
19 | private userService: UserService, | 19 | private userService: UserService, |
20 | private confirmService: ConfirmService, | 20 | private confirmService: ConfirmService, |
21 | private redirectService: RedirectService, | 21 | private redirectService: RedirectService, |
@@ -34,13 +34,13 @@ export class MyAccountDangerZoneComponent { | |||
34 | 34 | ||
35 | this.userService.deleteMe().subscribe( | 35 | this.userService.deleteMe().subscribe( |
36 | () => { | 36 | () => { |
37 | this.notificationsService.success(this.i18n('Success'), this.i18n('Your account is deleted.')) | 37 | this.notifier.success(this.i18n('Your account is deleted.')) |
38 | 38 | ||
39 | this.authService.logout() | 39 | this.authService.logout() |
40 | this.redirectService.redirectToHomepage() | 40 | this.redirectService.redirectToHomepage() |
41 | }, | 41 | }, |
42 | 42 | ||
43 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 43 | err => this.notifier.error(err.message) |
44 | ) | 44 | ) |
45 | } | 45 | } |
46 | } | 46 | } |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index 967e21f0b..a9503ed1b 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, UserService } from '../../../shared' | 3 | import { FormReactive, UserService } from '../../../shared' |
4 | import { User } from '@app/shared' | 4 | import { User } from '@app/shared' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -21,7 +21,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
21 | constructor ( | 21 | constructor ( |
22 | protected formValidatorService: FormValidatorService, | 22 | protected formValidatorService: FormValidatorService, |
23 | private userValidatorsService: UserValidatorsService, | 23 | private userValidatorsService: UserValidatorsService, |
24 | private notificationsService: NotificationsService, | 24 | private notifier: Notifier, |
25 | private userService: UserService, | 25 | private userService: UserService, |
26 | private i18n: I18n | 26 | private i18n: I18n |
27 | ) { | 27 | ) { |
@@ -53,7 +53,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
53 | this.user.account.displayName = displayName | 53 | this.user.account.displayName = displayName |
54 | this.user.account.description = description | 54 | this.user.account.description = description |
55 | 55 | ||
56 | this.notificationsService.success(this.i18n('Success'), this.i18n('Profile updated.')) | 56 | this.notifier.success(this.i18n('Profile updated.')) |
57 | }, | 57 | }, |
58 | 58 | ||
59 | err => this.error = err.message | 59 | err => this.error = err.message |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 62053d97b..f4b954e54 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { BytesPipe } from 'ngx-pipes' | 3 | import { BytesPipe } from 'ngx-pipes' |
4 | import { AuthService } from '../../core' | 4 | import { AuthService } from '../../core' |
5 | import { User } from '../../shared' | 5 | import { User } from '../../shared' |
@@ -19,7 +19,7 @@ export class MyAccountSettingsComponent implements OnInit { | |||
19 | constructor ( | 19 | constructor ( |
20 | private userService: UserService, | 20 | private userService: UserService, |
21 | private authService: AuthService, | 21 | private authService: AuthService, |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private i18n: I18n | 23 | private i18n: I18n |
24 | ) {} | 24 | ) {} |
25 | 25 | ||
@@ -48,12 +48,12 @@ export class MyAccountSettingsComponent implements OnInit { | |||
48 | this.userService.changeAvatar(formData) | 48 | this.userService.changeAvatar(formData) |
49 | .subscribe( | 49 | .subscribe( |
50 | data => { | 50 | data => { |
51 | this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) | 51 | this.notifier.success(this.i18n('Avatar changed.')) |
52 | 52 | ||
53 | this.user.updateAccountAvatar(data.avatar) | 53 | this.user.updateAccountAvatar(data.avatar) |
54 | }, | 54 | }, |
55 | 55 | ||
56 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 56 | err => this.notifier.error(err.message) |
57 | ) | 57 | ) |
58 | } | 58 | } |
59 | } | 59 | } |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts index 6c9a7ce75..b8f80bc1a 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { UserUpdateMe } from '../../../../../../shared' | 3 | import { UserUpdateMe } from '../../../../../../shared' |
4 | import { AuthService } from '../../../core' | 4 | import { AuthService } from '../../../core' |
5 | import { FormReactive, User, UserService } from '../../../shared' | 5 | import { FormReactive, User, UserService } from '../../../shared' |
@@ -19,7 +19,7 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
19 | constructor ( | 19 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 20 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | 21 | private authService: AuthService, |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private userService: UserService, | 23 | private userService: UserService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { | 25 | ) { |
@@ -54,12 +54,12 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
54 | 54 | ||
55 | this.userService.updateMyProfile(details).subscribe( | 55 | this.userService.updateMyProfile(details).subscribe( |
56 | () => { | 56 | () => { |
57 | this.notificationsService.success(this.i18n('Success'), this.i18n('Information updated.')) | 57 | this.notifier.success(this.i18n('Information updated.')) |
58 | 58 | ||
59 | this.authService.refreshUserInformation() | 59 | this.authService.refreshUserInformation() |
60 | }, | 60 | }, |
61 | 61 | ||
62 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 62 | err => this.notifier.error(err.message) |
63 | ) | 63 | ) |
64 | } | 64 | } |
65 | } | 65 | } |
diff --git a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts index 9517a3705..9d2dccdf0 100644 --- a/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.component.ts +++ b/client/src/app/+my-account/my-account-subscriptions/my-account-subscriptions.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 { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { UserSubscriptionService } from '@app/shared/user-subscription' | 5 | import { UserSubscriptionService } from '@app/shared/user-subscription' |
@@ -21,7 +21,7 @@ export class MyAccountSubscriptionsComponent implements OnInit { | |||
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
23 | private userSubscriptionService: UserSubscriptionService, | 23 | private userSubscriptionService: UserSubscriptionService, |
24 | private notificationsService: NotificationsService, | 24 | private notifier: Notifier, |
25 | private i18n: I18n | 25 | private i18n: I18n |
26 | ) {} | 26 | ) {} |
27 | 27 | ||
@@ -37,7 +37,7 @@ export class MyAccountSubscriptionsComponent implements OnInit { | |||
37 | this.pagination.totalItems = res.total | 37 | this.pagination.totalItems = res.total |
38 | }, | 38 | }, |
39 | 39 | ||
40 | error => this.notificationsService.error(this.i18n('Error'), error.message) | 40 | error => this.notifier.error(error.message) |
41 | ) | 41 | ) |
42 | } | 42 | } |
43 | 43 | ||
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 | ||
diff --git a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts index 5b920c98d..21a10c8ff 100644 --- a/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts +++ b/client/src/app/+my-account/my-account-video-imports/my-account-video-imports.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { RestPagination, RestTable } from '@app/shared' | 2 | import { RestPagination, RestTable } from '@app/shared' |
3 | import { SortMeta } from 'primeng/components/common/sortmeta' | 3 | import { SortMeta } from 'primeng/components/common/sortmeta' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { Notifier } from '@app/core' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { VideoImport, VideoImportState } from '../../../../../shared/models/videos' | 6 | import { VideoImport, VideoImportState } from '../../../../../shared/models/videos' |
7 | import { VideoImportService } from '@app/shared/video-import' | 7 | import { VideoImportService } from '@app/shared/video-import' |
@@ -19,7 +19,7 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit | |||
19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 19 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
20 | 20 | ||
21 | constructor ( | 21 | constructor ( |
22 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
23 | private videoImportService: VideoImportService, | 23 | private videoImportService: VideoImportService, |
24 | private i18n: I18n | 24 | private i18n: I18n |
25 | ) { | 25 | ) { |
@@ -58,7 +58,7 @@ export class MyAccountVideoImportsComponent extends RestTable implements OnInit | |||
58 | this.totalRecords = resultList.total | 58 | this.totalRecords = resultList.total |
59 | }, | 59 | }, |
60 | 60 | ||
61 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 61 | err => this.notifier.error(err.message) |
62 | ) | 62 | ) |
63 | } | 63 | } |
64 | } | 64 | } |
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts index 2d88ac760..41608f796 100644 --- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts +++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts | |||
@@ -5,7 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
5 | import { Location } from '@angular/common' | 5 | import { Location } from '@angular/common' |
6 | import { immutableAssign } from '@app/shared/misc/utils' | 6 | import { immutableAssign } from '@app/shared/misc/utils' |
7 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 7 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { Notifier } from '@app/core' |
9 | import { AuthService } from '../../core/auth' | 9 | import { AuthService } from '../../core/auth' |
10 | import { ConfirmService } from '../../core/confirm' | 10 | import { ConfirmService } from '../../core/confirm' |
11 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 11 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -40,7 +40,7 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
40 | protected router: Router, | 40 | protected router: Router, |
41 | protected route: ActivatedRoute, | 41 | protected route: ActivatedRoute, |
42 | protected authService: AuthService, | 42 | protected authService: AuthService, |
43 | protected notificationsService: NotificationsService, | 43 | protected notifier: Notifier, |
44 | protected location: Location, | 44 | protected location: Location, |
45 | protected screenService: ScreenService, | 45 | protected screenService: ScreenService, |
46 | protected i18n: I18n, | 46 | protected i18n: I18n, |
@@ -102,16 +102,13 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
102 | .pipe(concatAll()) | 102 | .pipe(concatAll()) |
103 | .subscribe( | 103 | .subscribe( |
104 | res => { | 104 | res => { |
105 | this.notificationsService.success( | 105 | this.notifier.success(this.i18n('{{deleteLength}} videos deleted.', { deleteLength: toDeleteVideosIds.length })) |
106 | this.i18n('Success'), | ||
107 | this.i18n('{{deleteLength}} videos deleted.', { deleteLength: toDeleteVideosIds.length }) | ||
108 | ) | ||
109 | 106 | ||
110 | this.abortSelectionMode() | 107 | this.abortSelectionMode() |
111 | this.reloadVideos() | 108 | this.reloadVideos() |
112 | }, | 109 | }, |
113 | 110 | ||
114 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 111 | err => this.notifier.error(err.message) |
115 | ) | 112 | ) |
116 | } | 113 | } |
117 | 114 | ||
@@ -124,15 +121,12 @@ export class MyAccountVideosComponent extends AbstractVideoList implements OnIni | |||
124 | 121 | ||
125 | this.videoService.removeVideo(video.id) | 122 | this.videoService.removeVideo(video.id) |
126 | .subscribe( | 123 | .subscribe( |
127 | status => { | 124 | () => { |
128 | this.notificationsService.success( | 125 | this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: video.name })) |
129 | this.i18n('Success'), | ||
130 | this.i18n('Video {{videoName}} deleted.', { videoName: video.name }) | ||
131 | ) | ||
132 | this.reloadVideos() | 126 | this.reloadVideos() |
133 | }, | 127 | }, |
134 | 128 | ||
135 | error => this.notificationsService.error(this.i18n('Error'), error.message) | 129 | error => this.notifier.error(error.message) |
136 | ) | 130 | ) |
137 | } | 131 | } |
138 | 132 | ||
diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index 9f94f3c13..37d7cf2a4 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { FormReactive, UserService } from '../../../shared/index' | 4 | import { FormReactive, UserService } from '../../../shared/index' |
5 | import { Video } from '@app/shared/video/video.model' | 5 | import { Video } from '@app/shared/video/video.model' |
@@ -25,7 +25,7 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
25 | protected formValidatorService: FormValidatorService, | 25 | protected formValidatorService: FormValidatorService, |
26 | private videoChangeOwnershipValidatorsService: VideoChangeOwnershipValidatorsService, | 26 | private videoChangeOwnershipValidatorsService: VideoChangeOwnershipValidatorsService, |
27 | private videoOwnershipService: VideoOwnershipService, | 27 | private videoOwnershipService: VideoOwnershipService, |
28 | private notificationsService: NotificationsService, | 28 | private notifier: Notifier, |
29 | private userService: UserService, | 29 | private userService: UserService, |
30 | private modalService: NgbModal, | 30 | private modalService: NgbModal, |
31 | private i18n: I18n | 31 | private i18n: I18n |
@@ -53,11 +53,9 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
53 | const query = event.query | 53 | const query = event.query |
54 | this.userService.autocomplete(query) | 54 | this.userService.autocomplete(query) |
55 | .subscribe( | 55 | .subscribe( |
56 | usernames => { | 56 | usernames => this.usernamePropositions = usernames, |
57 | this.usernamePropositions = usernames | ||
58 | }, | ||
59 | 57 | ||
60 | err => this.notificationsService.error('Error', err.message) | 58 | err => this.notifier.error(err.message) |
61 | ) | 59 | ) |
62 | } | 60 | } |
63 | 61 | ||
@@ -67,9 +65,9 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
67 | this.videoOwnershipService | 65 | this.videoOwnershipService |
68 | .changeOwnership(this.video.id, username) | 66 | .changeOwnership(this.video.id, username) |
69 | .subscribe( | 67 | .subscribe( |
70 | () => this.notificationsService.success(this.i18n('Success'), this.i18n('Ownership change request sent.')), | 68 | () => this.notifier.success(this.i18n('Ownership change request sent.')), |
71 | 69 | ||
72 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 70 | err => this.notifier.error(err.message) |
73 | ) | 71 | ) |
74 | } | 72 | } |
75 | } | 73 | } |
diff --git a/client/src/app/+my-account/shared/actor-avatar-info.component.ts b/client/src/app/+my-account/shared/actor-avatar-info.component.ts index 54bacc212..72c815a0c 100644 --- a/client/src/app/+my-account/shared/actor-avatar-info.component.ts +++ b/client/src/app/+my-account/shared/actor-avatar-info.component.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core' |
2 | import { ServerService } from '../../core/server' | 2 | import { ServerService } from '../../core/server' |
3 | import { NotificationsService } from 'angular2-notifications' | ||
4 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
5 | import { Account } from '@app/shared/account/account.model' | 4 | import { Account } from '@app/shared/account/account.model' |
5 | import { Notifier } from '@app/core' | ||
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'my-actor-avatar-info', | 8 | selector: 'my-actor-avatar-info', |
@@ -18,13 +18,13 @@ export class ActorAvatarInfoComponent { | |||
18 | 18 | ||
19 | constructor ( | 19 | constructor ( |
20 | private serverService: ServerService, | 20 | private serverService: ServerService, |
21 | private notificationsService: NotificationsService | 21 | private notifier: Notifier |
22 | ) {} | 22 | ) {} |
23 | 23 | ||
24 | onAvatarChange () { | 24 | onAvatarChange () { |
25 | const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] | 25 | const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] |
26 | if (avatarfile.size > this.maxAvatarSize) { | 26 | if (avatarfile.size > this.maxAvatarSize) { |
27 | this.notificationsService.error('Error', 'This image is too large.') | 27 | this.notifier.error('Error', 'This image is too large.') |
28 | return | 28 | return |
29 | } | 29 | } |
30 | 30 | ||
diff --git a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts index 995f42ffc..cfd471fa4 100644 --- a/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts +++ b/client/src/app/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier, RedirectService } from '@app/core' |
4 | import { ServerService } from '@app/core/server' | 4 | import { ServerService } from '@app/core/server' |
5 | import { RedirectService } from '@app/core' | 5 | import { FormReactive, UserService } from '@app/shared' |
6 | import { UserService, FormReactive } from '@app/shared' | ||
7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
8 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' | 7 | import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service' |
9 | 8 | ||
@@ -20,7 +19,7 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements | |||
20 | private userValidatorsService: UserValidatorsService, | 19 | private userValidatorsService: UserValidatorsService, |
21 | private userService: UserService, | 20 | private userService: UserService, |
22 | private serverService: ServerService, | 21 | private serverService: ServerService, |
23 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
24 | private redirectService: RedirectService, | 23 | private redirectService: RedirectService, |
25 | private i18n: I18n | 24 | private i18n: I18n |
26 | ) { | 25 | ) { |
@@ -46,12 +45,12 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements | |||
46 | 'An email with verification link will be sent to {{email}}.', | 45 | 'An email with verification link will be sent to {{email}}.', |
47 | { email } | 46 | { email } |
48 | ) | 47 | ) |
49 | this.notificationsService.success(this.i18n('Success'), message) | 48 | this.notifier.success(message) |
50 | this.redirectService.redirectToHomepage() | 49 | this.redirectService.redirectToHomepage() |
51 | }, | 50 | }, |
52 | 51 | ||
53 | err => { | 52 | err => { |
54 | this.notificationsService.error(this.i18n('Error'), err.message) | 53 | this.notifier.error(err.message) |
55 | } | 54 | } |
56 | ) | 55 | ) |
57 | } | 56 | } |
diff --git a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts index e4a5522c8..f9ecf664b 100644 --- a/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts +++ b/client/src/app/+verify-account/verify-account-email/verify-account-email.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { Notifier } from '@app/core' |
5 | import { UserService } from '@app/shared' | 5 | import { UserService } from '@app/shared' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
@@ -17,7 +17,7 @@ export class VerifyAccountEmailComponent implements OnInit { | |||
17 | 17 | ||
18 | constructor ( | 18 | constructor ( |
19 | private userService: UserService, | 19 | private userService: UserService, |
20 | private notificationsService: NotificationsService, | 20 | private notifier: Notifier, |
21 | private router: Router, | 21 | private router: Router, |
22 | private route: ActivatedRoute, | 22 | private route: ActivatedRoute, |
23 | private i18n: I18n | 23 | private i18n: I18n |
@@ -29,7 +29,7 @@ export class VerifyAccountEmailComponent implements OnInit { | |||
29 | this.verificationString = this.route.snapshot.queryParams['verificationString'] | 29 | this.verificationString = this.route.snapshot.queryParams['verificationString'] |
30 | 30 | ||
31 | if (!this.userId || !this.verificationString) { | 31 | if (!this.userId || !this.verificationString) { |
32 | this.notificationsService.error(this.i18n('Error'), this.i18n('Unable to find user id or verification string.')) | 32 | this.notifier.error(this.i18n('Unable to find user id or verification string.')) |
33 | } else { | 33 | } else { |
34 | this.verifyEmail() | 34 | this.verifyEmail() |
35 | } | 35 | } |
@@ -46,7 +46,7 @@ export class VerifyAccountEmailComponent implements OnInit { | |||
46 | }, | 46 | }, |
47 | 47 | ||
48 | err => { | 48 | err => { |
49 | this.notificationsService.error(this.i18n('Error'), err.message) | 49 | this.notifier.error(err.message) |
50 | } | 50 | } |
51 | ) | 51 | ) |
52 | } | 52 | } |
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts index 1f0744fb1..70c4374e0 100644 --- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts +++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { Location } from '@angular/common' | 3 | import { Location } from '@angular/common' |
4 | import { immutableAssign } from '@app/shared/misc/utils' | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { ConfirmService } from '../../core/confirm' | 6 | import { ConfirmService } from '../../core/confirm' |
8 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
@@ -13,6 +12,7 @@ import { tap } from 'rxjs/operators' | |||
13 | import { I18n } from '@ngx-translate/i18n-polyfill' | 12 | import { I18n } from '@ngx-translate/i18n-polyfill' |
14 | import { Subscription } from 'rxjs' | 13 | import { Subscription } from 'rxjs' |
15 | import { ScreenService } from '@app/shared/misc/screen.service' | 14 | import { ScreenService } from '@app/shared/misc/screen.service' |
15 | import { Notifier } from '@app/core' | ||
16 | 16 | ||
17 | @Component({ | 17 | @Component({ |
18 | selector: 'my-video-channel-videos', | 18 | selector: 'my-video-channel-videos', |
@@ -35,7 +35,7 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On | |||
35 | protected router: Router, | 35 | protected router: Router, |
36 | protected route: ActivatedRoute, | 36 | protected route: ActivatedRoute, |
37 | protected authService: AuthService, | 37 | protected authService: AuthService, |
38 | protected notificationsService: NotificationsService, | 38 | protected notifier: Notifier, |
39 | protected confirmService: ConfirmService, | 39 | protected confirmService: ConfirmService, |
40 | protected location: Location, | 40 | protected location: Location, |
41 | protected screenService: ScreenService, | 41 | protected screenService: ScreenService, |
diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html index 03f7e88ed..0489c9558 100644 --- a/client/src/app/app.component.html +++ b/client/src/app/app.component.html | |||
@@ -38,4 +38,15 @@ | |||
38 | 38 | ||
39 | <ngx-loading-bar [includeSpinner]="false"></ngx-loading-bar> | 39 | <ngx-loading-bar [includeSpinner]="false"></ngx-loading-bar> |
40 | <my-confirm></my-confirm> | 40 | <my-confirm></my-confirm> |
41 | <simple-notifications [options]="notificationOptions"></simple-notifications> | 41 | <p-toast position="bottom-right"> |
42 | <ng-template let-message pTemplate="message"> | ||
43 | <div class="message"> | ||
44 | <h3>{{ message.summary }}</h3> | ||
45 | <p>{{ message.detail }}</p> | ||
46 | </div> | ||
47 | |||
48 | <span *ngIf="message.severity === 'success'" class="glyphicon glyphicon-ok"></span> | ||
49 | <span *ngIf="message.severity === 'info'" class="glyphicon glyphicon-info-sign"></span> | ||
50 | <span *ngIf="message.severity === 'error'" class="glyphicon glyphicon-remove"></span> | ||
51 | </ng-template> | ||
52 | </p-toast> | ||
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index dc4d0bf6a..7583fdee8 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -15,19 +15,6 @@ import { fromEvent } from 'rxjs' | |||
15 | styleUrls: [ './app.component.scss' ] | 15 | styleUrls: [ './app.component.scss' ] |
16 | }) | 16 | }) |
17 | export class AppComponent implements OnInit { | 17 | export class AppComponent implements OnInit { |
18 | notificationOptions = { | ||
19 | timeOut: 5000, | ||
20 | lastOnBottom: true, | ||
21 | clickToClose: true, | ||
22 | maxLength: 0, | ||
23 | maxStack: 7, | ||
24 | showProgressBar: false, | ||
25 | pauseOnHover: false, | ||
26 | preventDuplicates: false, | ||
27 | preventLastDuplicates: 'visible', | ||
28 | rtl: false | ||
29 | } | ||
30 | |||
31 | isMenuDisplayed = true | 18 | isMenuDisplayed = true |
32 | isMenuChangedByUser = false | 19 | isMenuChangedByUser = false |
33 | 20 | ||
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts index 5f5730e02..79ea32ced 100644 --- a/client/src/app/core/auth/auth.service.ts +++ b/client/src/app/core/auth/auth.service.ts | |||
@@ -3,7 +3,7 @@ import { catchError, map, mergeMap, share, tap } from 'rxjs/operators' | |||
3 | import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { Router } from '@angular/router' | 5 | import { Router } from '@angular/router' |
6 | import { NotificationsService } from 'angular2-notifications' | 6 | import { Notifier } from '@app/core/notification' |
7 | import { OAuthClientLocal, User as UserServerModel, UserRefreshToken } from '../../../../../shared' | 7 | import { OAuthClientLocal, User as UserServerModel, UserRefreshToken } from '../../../../../shared' |
8 | import { User } from '../../../../../shared/models/users' | 8 | import { User } from '../../../../../shared/models/users' |
9 | import { UserLogin } from '../../../../../shared/models/users/user-login.model' | 9 | import { UserLogin } from '../../../../../shared/models/users/user-login.model' |
@@ -47,7 +47,7 @@ export class AuthService { | |||
47 | 47 | ||
48 | constructor ( | 48 | constructor ( |
49 | private http: HttpClient, | 49 | private http: HttpClient, |
50 | private notificationsService: NotificationsService, | 50 | private notifier: Notifier, |
51 | private hotkeysService: HotkeysService, | 51 | private hotkeysService: HotkeysService, |
52 | private restExtractor: RestExtractor, | 52 | private restExtractor: RestExtractor, |
53 | private router: Router, | 53 | private router: Router, |
@@ -105,9 +105,8 @@ export class AuthService { | |||
105 | ) | 105 | ) |
106 | } | 106 | } |
107 | 107 | ||
108 | // We put a bigger timeout | 108 | // We put a bigger timeout: this is an important message |
109 | // This is an important message | 109 | this.notifier.error(errorMessage, this.i18n('Error'), 7000) |
110 | this.notificationsService.error(this.i18n('Error'), errorMessage, { timeOut: 7000 }) | ||
111 | } | 110 | } |
112 | ) | 111 | ) |
113 | } | 112 | } |
diff --git a/client/src/app/core/auth/index.ts b/client/src/app/core/auth/index.ts index bc7bfec0e..8e5caa7ed 100644 --- a/client/src/app/core/auth/index.ts +++ b/client/src/app/core/auth/index.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | export * from './auth-status.model' | 1 | export * from './auth-status.model' |
2 | export * from './auth-user.model' | 2 | export * from './auth-user.model' |
3 | export * from './auth.service' | 3 | export * from './auth.service' |
4 | export * from '../routing/login-guard.service' | ||
diff --git a/client/src/app/core/core.module.ts b/client/src/app/core/core.module.ts index 8a6654aa1..7c0d4ac8f 100644 --- a/client/src/app/core/core.module.ts +++ b/client/src/app/core/core.module.ts | |||
@@ -7,8 +7,6 @@ import { LoadingBarModule } from '@ngx-loading-bar/core' | |||
7 | import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client' | 7 | import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client' |
8 | import { LoadingBarRouterModule } from '@ngx-loading-bar/router' | 8 | import { LoadingBarRouterModule } from '@ngx-loading-bar/router' |
9 | 9 | ||
10 | import { SimpleNotificationsModule } from 'angular2-notifications' | ||
11 | |||
12 | import { AuthService } from './auth' | 10 | import { AuthService } from './auth' |
13 | import { ConfirmComponent, ConfirmService } from './confirm' | 11 | import { ConfirmComponent, ConfirmService } from './confirm' |
14 | import { throwIfAlreadyLoaded } from './module-import-guard' | 12 | import { throwIfAlreadyLoaded } from './module-import-guard' |
@@ -16,7 +14,10 @@ import { LoginGuard, RedirectService, UserRightGuard } from './routing' | |||
16 | import { ServerService } from './server' | 14 | import { ServerService } from './server' |
17 | import { ThemeService } from './theme' | 15 | import { ThemeService } from './theme' |
18 | import { HotkeyModule } from 'angular2-hotkeys' | 16 | import { HotkeyModule } from 'angular2-hotkeys' |
19 | import { CheatSheetComponent } from '@app/core/hotkeys' | 17 | import { CheatSheetComponent } from './hotkeys' |
18 | import { ToastModule } from 'primeng/toast' | ||
19 | import { Notifier } from './notification' | ||
20 | import { MessageService } from 'primeng/api' | ||
20 | 21 | ||
21 | @NgModule({ | 22 | @NgModule({ |
22 | imports: [ | 23 | imports: [ |
@@ -25,11 +26,10 @@ import { CheatSheetComponent } from '@app/core/hotkeys' | |||
25 | FormsModule, | 26 | FormsModule, |
26 | BrowserAnimationsModule, | 27 | BrowserAnimationsModule, |
27 | 28 | ||
28 | SimpleNotificationsModule.forRoot(), | ||
29 | |||
30 | LoadingBarHttpClientModule, | 29 | LoadingBarHttpClientModule, |
31 | LoadingBarRouterModule, | 30 | LoadingBarRouterModule, |
32 | LoadingBarModule, | 31 | LoadingBarModule, |
32 | ToastModule, | ||
33 | 33 | ||
34 | HotkeyModule.forRoot({ | 34 | HotkeyModule.forRoot({ |
35 | cheatSheetCloseEsc: true | 35 | cheatSheetCloseEsc: true |
@@ -42,10 +42,11 @@ import { CheatSheetComponent } from '@app/core/hotkeys' | |||
42 | ], | 42 | ], |
43 | 43 | ||
44 | exports: [ | 44 | exports: [ |
45 | SimpleNotificationsModule, | ||
46 | LoadingBarHttpClientModule, | 45 | LoadingBarHttpClientModule, |
47 | LoadingBarModule, | 46 | LoadingBarModule, |
48 | 47 | ||
48 | ToastModule, | ||
49 | |||
49 | ConfirmComponent, | 50 | ConfirmComponent, |
50 | CheatSheetComponent | 51 | CheatSheetComponent |
51 | ], | 52 | ], |
@@ -57,7 +58,9 @@ import { CheatSheetComponent } from '@app/core/hotkeys' | |||
57 | ThemeService, | 58 | ThemeService, |
58 | LoginGuard, | 59 | LoginGuard, |
59 | UserRightGuard, | 60 | UserRightGuard, |
60 | RedirectService | 61 | RedirectService, |
62 | Notifier, | ||
63 | MessageService | ||
61 | ] | 64 | ] |
62 | }) | 65 | }) |
63 | export class CoreModule { | 66 | export class CoreModule { |
diff --git a/client/src/app/core/index.ts b/client/src/app/core/index.ts index 524589d74..f664aff41 100644 --- a/client/src/app/core/index.ts +++ b/client/src/app/core/index.ts | |||
@@ -2,6 +2,7 @@ export * from './auth' | |||
2 | export * from './confirm' | 2 | export * from './confirm' |
3 | export * from './routing' | 3 | export * from './routing' |
4 | export * from './server' | 4 | export * from './server' |
5 | export * from './notification' | ||
5 | export * from './theme' | 6 | export * from './theme' |
6 | 7 | ||
7 | export * from './core.module' | 8 | export * from './core.module' |
diff --git a/client/src/app/core/notification/index.ts b/client/src/app/core/notification/index.ts new file mode 100644 index 000000000..8b0cfde5f --- /dev/null +++ b/client/src/app/core/notification/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './notifier.service' | |||
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.ts new file mode 100644 index 000000000..9833c65a0 --- /dev/null +++ b/client/src/app/core/notification/notifier.service.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { MessageService } from 'primeng/api' | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | |||
5 | @Injectable() | ||
6 | export class Notifier { | ||
7 | readonly TIMEOUT = 5000 | ||
8 | |||
9 | constructor ( | ||
10 | private i18n: I18n, | ||
11 | private messageService: MessageService) { | ||
12 | } | ||
13 | |||
14 | info (text: string, title?: string, timeout?: number) { | ||
15 | if (!title) title = this.i18n('Info') | ||
16 | |||
17 | return this.notify('info', text, title, timeout) | ||
18 | } | ||
19 | |||
20 | error (text: string, title?: string, timeout?: number) { | ||
21 | if (!title) title = this.i18n('Error') | ||
22 | |||
23 | return this.notify('error', text, title, timeout) | ||
24 | } | ||
25 | |||
26 | success (text: string, title?: string, timeout?: number) { | ||
27 | if (!title) title = this.i18n('Success') | ||
28 | |||
29 | return this.notify('success', text, title, timeout) | ||
30 | } | ||
31 | |||
32 | private notify (severity: 'success' | 'info' | 'warn' | 'error', text: string, title: string, timeout?: number) { | ||
33 | this.messageService.add({ | ||
34 | severity, | ||
35 | summary: title, | ||
36 | detail: text, | ||
37 | closable: true, | ||
38 | life: timeout || this.TIMEOUT | ||
39 | }) | ||
40 | } | ||
41 | } | ||
diff --git a/client/src/app/core/routing/user-right-guard.service.ts b/client/src/app/core/routing/user-right-guard.service.ts index 65d029977..50c3d8c19 100644 --- a/client/src/app/core/routing/user-right-guard.service.ts +++ b/client/src/app/core/routing/user-right-guard.service.ts | |||
@@ -7,7 +7,7 @@ import { | |||
7 | Router | 7 | Router |
8 | } from '@angular/router' | 8 | } from '@angular/router' |
9 | 9 | ||
10 | import { AuthService } from '../auth' | 10 | import { AuthService } from '../auth/auth.service' |
11 | 11 | ||
12 | @Injectable() | 12 | @Injectable() |
13 | export class UserRightGuard implements CanActivate, CanActivateChild { | 13 | export class UserRightGuard implements CanActivate, CanActivateChild { |
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts index 18f8f69e5..fc2442c0e 100644 --- a/client/src/app/login/login.component.ts +++ b/client/src/app/login/login.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { RedirectService, ServerService } from '@app/core' | 2 | import { Notifier, RedirectService, ServerService } from '@app/core' |
3 | import { UserService } from '@app/shared' | 3 | import { UserService } from '@app/shared' |
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { AuthService } from '../core' | 4 | import { AuthService } from '../core' |
6 | import { FormReactive } from '../shared' | 5 | import { FormReactive } from '../shared' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -34,7 +33,7 @@ export class LoginComponent extends FormReactive implements OnInit { | |||
34 | private userService: UserService, | 33 | private userService: UserService, |
35 | private serverService: ServerService, | 34 | private serverService: ServerService, |
36 | private redirectService: RedirectService, | 35 | private redirectService: RedirectService, |
37 | private notificationsService: NotificationsService, | 36 | private notifier: Notifier, |
38 | private i18n: I18n | 37 | private i18n: I18n |
39 | ) { | 38 | ) { |
40 | super() | 39 | super() |
@@ -82,11 +81,11 @@ export class LoginComponent extends FormReactive implements OnInit { | |||
82 | 'An email with the reset password instructions will be sent to {{email}}.', | 81 | 'An email with the reset password instructions will be sent to {{email}}.', |
83 | { email: this.forgotPasswordEmail } | 82 | { email: this.forgotPasswordEmail } |
84 | ) | 83 | ) |
85 | this.notificationsService.success(this.i18n('Success'), message) | 84 | this.notifier.success(message) |
86 | this.hideForgotPasswordModal() | 85 | this.hideForgotPasswordModal() |
87 | }, | 86 | }, |
88 | 87 | ||
89 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 88 | err => this.notifier.error(err.message) |
90 | ) | 89 | ) |
91 | } | 90 | } |
92 | 91 | ||
diff --git a/client/src/app/reset-password/reset-password.component.ts b/client/src/app/reset-password/reset-password.component.ts index af1298de6..07b93ee73 100644 --- a/client/src/app/reset-password/reset-password.component.ts +++ b/client/src/app/reset-password/reset-password.component.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { UserService, UserValidatorsService } from '@app/shared' | 3 | import { UserService, UserValidatorsService, FormReactive } from '@app/shared' |
4 | import { NotificationsService } from 'angular2-notifications' | 4 | import { Notifier } from '@app/core' |
5 | import { FormReactive } from '../shared' | ||
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
8 | import { ResetPasswordValidatorsService } from '@app/shared/forms/form-validators/reset-password-validators.service' | 7 | import { ResetPasswordValidatorsService } from '@app/shared/forms/form-validators/reset-password-validators.service' |
@@ -22,7 +21,7 @@ export class ResetPasswordComponent extends FormReactive implements OnInit { | |||
22 | private resetPasswordValidatorsService: ResetPasswordValidatorsService, | 21 | private resetPasswordValidatorsService: ResetPasswordValidatorsService, |
23 | private userValidatorsService: UserValidatorsService, | 22 | private userValidatorsService: UserValidatorsService, |
24 | private userService: UserService, | 23 | private userService: UserService, |
25 | private notificationsService: NotificationsService, | 24 | private notifier: Notifier, |
26 | private router: Router, | 25 | private router: Router, |
27 | private route: ActivatedRoute, | 26 | private route: ActivatedRoute, |
28 | private i18n: I18n | 27 | private i18n: I18n |
@@ -40,7 +39,7 @@ export class ResetPasswordComponent extends FormReactive implements OnInit { | |||
40 | this.verificationString = this.route.snapshot.queryParams['verificationString'] | 39 | this.verificationString = this.route.snapshot.queryParams['verificationString'] |
41 | 40 | ||
42 | if (!this.userId || !this.verificationString) { | 41 | if (!this.userId || !this.verificationString) { |
43 | this.notificationsService.error(this.i18n('Error'), this.i18n('Unable to find user id or verification string.')) | 42 | this.notifier.error(this.i18n('Unable to find user id or verification string.')) |
44 | this.router.navigate([ '/' ]) | 43 | this.router.navigate([ '/' ]) |
45 | } | 44 | } |
46 | } | 45 | } |
@@ -49,11 +48,11 @@ export class ResetPasswordComponent extends FormReactive implements OnInit { | |||
49 | this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password) | 48 | this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password) |
50 | .subscribe( | 49 | .subscribe( |
51 | () => { | 50 | () => { |
52 | this.notificationsService.success(this.i18n('Success'), this.i18n('Your password has been successfully reset!')) | 51 | this.notifier.success(this.i18n('Your password has been successfully reset!')) |
53 | this.router.navigate([ '/login' ]) | 52 | this.router.navigate([ '/login' ]) |
54 | }, | 53 | }, |
55 | 54 | ||
56 | err => this.notificationsService.error('Error', err.message) | 55 | err => this.notifier.error(err.message) |
57 | ) | 56 | ) |
58 | } | 57 | } |
59 | 58 | ||
diff --git a/client/src/app/search/search-filters.component.ts b/client/src/app/search/search-filters.component.ts index 8d7f84ac1..3fdc6df35 100644 --- a/client/src/app/search/search-filters.component.ts +++ b/client/src/app/search/search-filters.component.ts | |||
@@ -1,10 +1,6 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ServerService } from '@app/core' |
3 | import { RedirectService, ServerService } from '@app/core' | ||
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { SearchService } from '@app/search/search.service' | ||
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { MetaService } from '@ngx-meta/core' | ||
8 | import { AdvancedSearch } from '@app/search/advanced-search.model' | 4 | import { AdvancedSearch } from '@app/search/advanced-search.model' |
9 | import { VideoConstant } from '../../../../shared' | 5 | import { VideoConstant } from '../../../../shared' |
10 | 6 | ||
diff --git a/client/src/app/search/search.component.ts b/client/src/app/search/search.component.ts index 3d17e6d96..474b72824 100644 --- a/client/src/app/search/search.component.ts +++ b/client/src/app/search/search.component.ts | |||
@@ -1,7 +1,6 @@ | |||
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 { AuthService } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { forkJoin, Subscription } from 'rxjs' | 4 | import { forkJoin, Subscription } from 'rxjs' |
6 | import { SearchService } from '@app/search/search.service' | 5 | import { SearchService } from '@app/search/search.service' |
7 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' | 6 | import { ComponentPagination } from '@app/shared/rest/component-pagination.model' |
@@ -40,7 +39,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
40 | private route: ActivatedRoute, | 39 | private route: ActivatedRoute, |
41 | private router: Router, | 40 | private router: Router, |
42 | private metaService: MetaService, | 41 | private metaService: MetaService, |
43 | private notificationsService: NotificationsService, | 42 | private notifier: Notifier, |
44 | private searchService: SearchService, | 43 | private searchService: SearchService, |
45 | private authService: AuthService | 44 | private authService: AuthService |
46 | ) { } | 45 | ) { } |
@@ -68,7 +67,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
68 | this.search() | 67 | this.search() |
69 | }, | 68 | }, |
70 | 69 | ||
71 | err => this.notificationsService.error('Error', err.text) | 70 | err => this.notifier.error(err.text) |
72 | ) | 71 | ) |
73 | } | 72 | } |
74 | 73 | ||
@@ -112,9 +111,7 @@ export class SearchComponent implements OnInit, OnDestroy { | |||
112 | this.firstSearch = false | 111 | this.firstSearch = false |
113 | }, | 112 | }, |
114 | 113 | ||
115 | error => { | 114 | err => this.notifier.error(err.message) |
116 | this.notificationsService.error(this.i18n('Error'), error.message) | ||
117 | } | ||
118 | ) | 115 | ) |
119 | 116 | ||
120 | } | 117 | } |
diff --git a/client/src/app/shared/forms/reactive-file.component.ts b/client/src/app/shared/forms/reactive-file.component.ts index 8d22aa56c..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 @@ | |||
1 | import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@angular/core' |
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | 5 | ||
6 | @Component({ | 6 | @Component({ |
@@ -30,7 +30,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { | |||
30 | private file: File | 30 | private file: File |
31 | 31 | ||
32 | constructor ( | 32 | constructor ( |
33 | private notificationsService: NotificationsService, | 33 | private notifier: Notifier, |
34 | private i18n: I18n | 34 | private i18n: I18n |
35 | ) {} | 35 | ) {} |
36 | 36 | ||
@@ -49,7 +49,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor { | |||
49 | const [ file ] = event.target.files | 49 | const [ file ] = event.target.files |
50 | 50 | ||
51 | if (file.size > this.maxFileSize) { | 51 | if (file.size > this.maxFileSize) { |
52 | this.notificationsService.error(this.i18n('Error'), this.i18n('This file is too large.')) | 52 | this.notifier.error(this.i18n('This file is too large.')) |
53 | return | 53 | return |
54 | } | 54 | } |
55 | 55 | ||
diff --git a/client/src/app/shared/moderation/user-ban-modal.component.ts b/client/src/app/shared/moderation/user-ban-modal.component.ts index 60bd442dd..f755ba0e8 100644 --- a/client/src/app/shared/moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/moderation/user-ban-modal.component.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 5 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
@@ -23,7 +23,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit { | |||
23 | constructor ( | 23 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 24 | protected formValidatorService: FormValidatorService, |
25 | private modalService: NgbModal, | 25 | private modalService: NgbModal, |
26 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
27 | private userService: UserService, | 27 | private userService: UserService, |
28 | private userValidatorsService: UserValidatorsService, | 28 | private userValidatorsService: UserValidatorsService, |
29 | private i18n: I18n | 29 | private i18n: I18n |
@@ -57,13 +57,13 @@ export class UserBanModalComponent extends FormReactive implements OnInit { | |||
57 | ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length }) | 57 | ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length }) |
58 | : this.i18n('User {{username}} banned.', { username: this.usersToBan.username }) | 58 | : this.i18n('User {{username}} banned.', { username: this.usersToBan.username }) |
59 | 59 | ||
60 | this.notificationsService.success(this.i18n('Success'), message) | 60 | this.notifier.success(message) |
61 | 61 | ||
62 | this.userBanned.emit(this.usersToBan) | 62 | this.userBanned.emit(this.usersToBan) |
63 | this.hideBanUserModal() | 63 | this.hideBanUserModal() |
64 | }, | 64 | }, |
65 | 65 | ||
66 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 66 | err => this.notifier.error(err.message) |
67 | ) | 67 | ) |
68 | } | 68 | } |
69 | 69 | ||
diff --git a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts index e3c9db923..9a2461ebf 100644 --- a/client/src/app/shared/moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/moderation/user-moderation-dropdown.component.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | ||
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { I18n } from '@ngx-translate/i18n-polyfill' |
4 | import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' | 3 | import { DropdownAction } from '@app/shared/buttons/action-dropdown.component' |
5 | import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' | 4 | import { UserBanModalComponent } from '@app/shared/moderation/user-ban-modal.component' |
6 | import { UserService } from '@app/shared/users' | 5 | import { UserService } from '@app/shared/users' |
7 | import { AuthService, ConfirmService, ServerService } from '@app/core' | 6 | import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core' |
8 | import { User, UserRight } from '../../../../../shared/models/users' | 7 | import { User, UserRight } from '../../../../../shared/models/users' |
9 | import { Account } from '@app/shared/account/account.model' | 8 | import { Account } from '@app/shared/account/account.model' |
10 | import { BlocklistService } from '@app/shared/blocklist' | 9 | import { BlocklistService } from '@app/shared/blocklist' |
@@ -30,7 +29,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
30 | 29 | ||
31 | constructor ( | 30 | constructor ( |
32 | private authService: AuthService, | 31 | private authService: AuthService, |
33 | private notificationsService: NotificationsService, | 32 | private notifier: Notifier, |
34 | private confirmService: ConfirmService, | 33 | private confirmService: ConfirmService, |
35 | private serverService: ServerService, | 34 | private serverService: ServerService, |
36 | private userService: UserService, | 35 | private userService: UserService, |
@@ -48,7 +47,7 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
48 | 47 | ||
49 | openBanUserModal (user: User) { | 48 | openBanUserModal (user: User) { |
50 | if (user.username === 'root') { | 49 | if (user.username === 'root') { |
51 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot ban root.')) | 50 | this.notifier.error(this.i18n('You cannot ban root.')) |
52 | return | 51 | return |
53 | } | 52 | } |
54 | 53 | ||
@@ -67,21 +66,18 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
67 | this.userService.unbanUsers(user) | 66 | this.userService.unbanUsers(user) |
68 | .subscribe( | 67 | .subscribe( |
69 | () => { | 68 | () => { |
70 | this.notificationsService.success( | 69 | this.notifier.success(this.i18n('User {{username}} unbanned.', { username: user.username })) |
71 | this.i18n('Success'), | ||
72 | this.i18n('User {{username}} unbanned.', { username: user.username }) | ||
73 | ) | ||
74 | 70 | ||
75 | this.userChanged.emit() | 71 | this.userChanged.emit() |
76 | }, | 72 | }, |
77 | 73 | ||
78 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 74 | err => this.notifier.error(err.message) |
79 | ) | 75 | ) |
80 | } | 76 | } |
81 | 77 | ||
82 | async removeUser (user: User) { | 78 | async removeUser (user: User) { |
83 | if (user.username === 'root') { | 79 | if (user.username === 'root') { |
84 | this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.')) | 80 | this.notifier.error(this.i18n('You cannot delete root.')) |
85 | return | 81 | return |
86 | } | 82 | } |
87 | 83 | ||
@@ -91,29 +87,23 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
91 | 87 | ||
92 | this.userService.removeUser(user).subscribe( | 88 | this.userService.removeUser(user).subscribe( |
93 | () => { | 89 | () => { |
94 | this.notificationsService.success( | 90 | this.notifier.success(this.i18n('User {{username}} deleted.', { username: user.username })) |
95 | this.i18n('Success'), | ||
96 | this.i18n('User {{username}} deleted.', { username: user.username }) | ||
97 | ) | ||
98 | this.userDeleted.emit() | 91 | this.userDeleted.emit() |
99 | }, | 92 | }, |
100 | 93 | ||
101 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 94 | err => this.notifier.error(err.message) |
102 | ) | 95 | ) |
103 | } | 96 | } |
104 | 97 | ||
105 | setEmailAsVerified (user: User) { | 98 | setEmailAsVerified (user: User) { |
106 | this.userService.updateUser(user.id, { emailVerified: true }).subscribe( | 99 | this.userService.updateUser(user.id, { emailVerified: true }).subscribe( |
107 | () => { | 100 | () => { |
108 | this.notificationsService.success( | 101 | this.notifier.success(this.i18n('User {{username}} email set as verified', { username: user.username })) |
109 | this.i18n('Success'), | ||
110 | this.i18n('User {{username}} email set as verified', { username: user.username }) | ||
111 | ) | ||
112 | 102 | ||
113 | this.userChanged.emit() | 103 | this.userChanged.emit() |
114 | }, | 104 | }, |
115 | 105 | ||
116 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 106 | err => this.notifier.error(err.message) |
117 | ) | 107 | ) |
118 | } | 108 | } |
119 | 109 | ||
@@ -121,16 +111,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
121 | this.blocklistService.blockAccountByUser(account) | 111 | this.blocklistService.blockAccountByUser(account) |
122 | .subscribe( | 112 | .subscribe( |
123 | () => { | 113 | () => { |
124 | this.notificationsService.success( | 114 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost })) |
125 | this.i18n('Success'), | ||
126 | this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost }) | ||
127 | ) | ||
128 | 115 | ||
129 | this.account.mutedByUser = true | 116 | this.account.mutedByUser = true |
130 | this.userChanged.emit() | 117 | this.userChanged.emit() |
131 | }, | 118 | }, |
132 | 119 | ||
133 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 120 | err => this.notifier.error(err.message) |
134 | ) | 121 | ) |
135 | } | 122 | } |
136 | 123 | ||
@@ -138,16 +125,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
138 | this.blocklistService.unblockAccountByUser(account) | 125 | this.blocklistService.unblockAccountByUser(account) |
139 | .subscribe( | 126 | .subscribe( |
140 | () => { | 127 | () => { |
141 | this.notificationsService.success( | 128 | this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost })) |
142 | this.i18n('Success'), | ||
143 | this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost }) | ||
144 | ) | ||
145 | 129 | ||
146 | this.account.mutedByUser = false | 130 | this.account.mutedByUser = false |
147 | this.userChanged.emit() | 131 | this.userChanged.emit() |
148 | }, | 132 | }, |
149 | 133 | ||
150 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 134 | err => this.notifier.error(err.message) |
151 | ) | 135 | ) |
152 | } | 136 | } |
153 | 137 | ||
@@ -155,16 +139,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
155 | this.blocklistService.blockServerByUser(host) | 139 | this.blocklistService.blockServerByUser(host) |
156 | .subscribe( | 140 | .subscribe( |
157 | () => { | 141 | () => { |
158 | this.notificationsService.success( | 142 | this.notifier.success(this.i18n('Instance {{host}} muted.', { host })) |
159 | this.i18n('Success'), | ||
160 | this.i18n('Instance {{host}} muted.', { host }) | ||
161 | ) | ||
162 | 143 | ||
163 | this.account.mutedServerByUser = true | 144 | this.account.mutedServerByUser = true |
164 | this.userChanged.emit() | 145 | this.userChanged.emit() |
165 | }, | 146 | }, |
166 | 147 | ||
167 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 148 | err => this.notifier.error(err.message) |
168 | ) | 149 | ) |
169 | } | 150 | } |
170 | 151 | ||
@@ -172,16 +153,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
172 | this.blocklistService.unblockServerByUser(host) | 153 | this.blocklistService.unblockServerByUser(host) |
173 | .subscribe( | 154 | .subscribe( |
174 | () => { | 155 | () => { |
175 | this.notificationsService.success( | 156 | this.notifier.success(this.i18n('Instance {{host}} unmuted.', { host })) |
176 | this.i18n('Success'), | ||
177 | this.i18n('Instance {{host}} unmuted.', { host }) | ||
178 | ) | ||
179 | 157 | ||
180 | this.account.mutedServerByUser = false | 158 | this.account.mutedServerByUser = false |
181 | this.userChanged.emit() | 159 | this.userChanged.emit() |
182 | }, | 160 | }, |
183 | 161 | ||
184 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 162 | err => this.notifier.error(err.message) |
185 | ) | 163 | ) |
186 | } | 164 | } |
187 | 165 | ||
@@ -189,16 +167,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
189 | this.blocklistService.blockAccountByInstance(account) | 167 | this.blocklistService.blockAccountByInstance(account) |
190 | .subscribe( | 168 | .subscribe( |
191 | () => { | 169 | () => { |
192 | this.notificationsService.success( | 170 | this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })) |
193 | this.i18n('Success'), | ||
194 | this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost }) | ||
195 | ) | ||
196 | 171 | ||
197 | this.account.mutedByInstance = true | 172 | this.account.mutedByInstance = true |
198 | this.userChanged.emit() | 173 | this.userChanged.emit() |
199 | }, | 174 | }, |
200 | 175 | ||
201 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 176 | err => this.notifier.error(err.message) |
202 | ) | 177 | ) |
203 | } | 178 | } |
204 | 179 | ||
@@ -206,16 +181,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
206 | this.blocklistService.unblockAccountByInstance(account) | 181 | this.blocklistService.unblockAccountByInstance(account) |
207 | .subscribe( | 182 | .subscribe( |
208 | () => { | 183 | () => { |
209 | this.notificationsService.success( | 184 | this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost })) |
210 | this.i18n('Success'), | ||
211 | this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost }) | ||
212 | ) | ||
213 | 185 | ||
214 | this.account.mutedByInstance = false | 186 | this.account.mutedByInstance = false |
215 | this.userChanged.emit() | 187 | this.userChanged.emit() |
216 | }, | 188 | }, |
217 | 189 | ||
218 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 190 | err => this.notifier.error(err.message) |
219 | ) | 191 | ) |
220 | } | 192 | } |
221 | 193 | ||
@@ -223,16 +195,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
223 | this.blocklistService.blockServerByInstance(host) | 195 | this.blocklistService.blockServerByInstance(host) |
224 | .subscribe( | 196 | .subscribe( |
225 | () => { | 197 | () => { |
226 | this.notificationsService.success( | 198 | this.notifier.success(this.i18n('Instance {{host}} muted by the instance.', { host })) |
227 | this.i18n('Success'), | ||
228 | this.i18n('Instance {{host}} muted by the instance.', { host }) | ||
229 | ) | ||
230 | 199 | ||
231 | this.account.mutedServerByInstance = true | 200 | this.account.mutedServerByInstance = true |
232 | this.userChanged.emit() | 201 | this.userChanged.emit() |
233 | }, | 202 | }, |
234 | 203 | ||
235 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 204 | err => this.notifier.error(err.message) |
236 | ) | 205 | ) |
237 | } | 206 | } |
238 | 207 | ||
@@ -240,16 +209,13 @@ export class UserModerationDropdownComponent implements OnChanges { | |||
240 | this.blocklistService.unblockServerByInstance(host) | 209 | this.blocklistService.unblockServerByInstance(host) |
241 | .subscribe( | 210 | .subscribe( |
242 | () => { | 211 | () => { |
243 | this.notificationsService.success( | 212 | this.notifier.success(this.i18n('Instance {{host}} unmuted by the instance.', { host })) |
244 | this.i18n('Success'), | ||
245 | this.i18n('Instance {{host}} unmuted by the instance.', { host }) | ||
246 | ) | ||
247 | 213 | ||
248 | this.account.mutedServerByInstance = false | 214 | this.account.mutedServerByInstance = false |
249 | this.userChanged.emit() | 215 | this.userChanged.emit() |
250 | }, | 216 | }, |
251 | 217 | ||
252 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 218 | err => this.notifier.error(err.message) |
253 | ) | 219 | ) |
254 | } | 220 | } |
255 | 221 | ||
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 | ||
diff --git a/client/src/app/shared/video/abstract-video-list.ts b/client/src/app/shared/video/abstract-video-list.ts index 2d32dd6ad..d234c8bfa 100644 --- a/client/src/app/shared/video/abstract-video-list.ts +++ b/client/src/app/shared/video/abstract-video-list.ts | |||
@@ -3,7 +3,6 @@ import { ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core' | |||
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { Location } from '@angular/common' | 4 | import { Location } from '@angular/common' |
5 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' | 5 | import { InfiniteScrollerDirective } from '@app/shared/video/infinite-scroller.directive' |
6 | import { NotificationsService } from 'angular2-notifications' | ||
7 | import { fromEvent, Observable, Subscription } from 'rxjs' | 6 | import { fromEvent, Observable, Subscription } from 'rxjs' |
8 | import { AuthService } from '../../core/auth' | 7 | import { AuthService } from '../../core/auth' |
9 | import { ComponentPagination } from '../rest/component-pagination.model' | 8 | import { ComponentPagination } from '../rest/component-pagination.model' |
@@ -13,6 +12,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill' | |||
13 | import { ScreenService } from '@app/shared/misc/screen.service' | 12 | import { ScreenService } from '@app/shared/misc/screen.service' |
14 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | 13 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' |
15 | import { Syndication } from '@app/shared/video/syndication.model' | 14 | import { Syndication } from '@app/shared/video/syndication.model' |
15 | import { Notifier } from '@app/core' | ||
16 | 16 | ||
17 | export abstract class AbstractVideoList implements OnInit, OnDestroy { | 17 | export abstract class AbstractVideoList implements OnInit, OnDestroy { |
18 | private static LINES_PER_PAGE = 4 | 18 | private static LINES_PER_PAGE = 4 |
@@ -43,7 +43,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
43 | protected baseVideoWidth = 215 | 43 | protected baseVideoWidth = 215 |
44 | protected baseVideoHeight = 205 | 44 | protected baseVideoHeight = 205 |
45 | 45 | ||
46 | protected abstract notificationsService: NotificationsService | 46 | protected abstract notifier: Notifier |
47 | protected abstract authService: AuthService | 47 | protected abstract authService: AuthService |
48 | protected abstract router: Router | 48 | protected abstract router: Router |
49 | protected abstract route: ActivatedRoute | 49 | protected abstract route: ActivatedRoute |
@@ -157,7 +157,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy { | |||
157 | }, | 157 | }, |
158 | error => { | 158 | error => { |
159 | this.loadingPage[page] = false | 159 | this.loadingPage[page] = false |
160 | this.notificationsService.error(this.i18n('Error'), error.message) | 160 | this.notifier.error(error.message) |
161 | } | 161 | } |
162 | ) | 162 | ) |
163 | } | 163 | } |
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts index 3341d4e09..13941ec79 100644 --- a/client/src/app/signup/signup.component.ts +++ b/client/src/app/signup/signup.component.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' |
3 | import { UserCreate } from '../../../../shared' | 3 | import { UserCreate } from '../../../../shared' |
4 | import { FormReactive, UserService, UserValidatorsService } from '../shared' | 4 | import { FormReactive, UserService, UserValidatorsService } from '../shared' |
5 | import { AuthService, RedirectService, ServerService } from '@app/core' | ||
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
7 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
8 | 7 | ||
@@ -20,7 +19,7 @@ export class SignupComponent extends FormReactive implements OnInit { | |||
20 | protected formValidatorService: FormValidatorService, | 19 | protected formValidatorService: FormValidatorService, |
21 | private authService: AuthService, | 20 | private authService: AuthService, |
22 | private userValidatorsService: UserValidatorsService, | 21 | private userValidatorsService: UserValidatorsService, |
23 | private notificationsService: NotificationsService, | 22 | private notifier: Notifier, |
24 | private userService: UserService, | 23 | private userService: UserService, |
25 | private serverService: ServerService, | 24 | private serverService: ServerService, |
26 | private redirectService: RedirectService, | 25 | private redirectService: RedirectService, |
@@ -64,10 +63,7 @@ export class SignupComponent extends FormReactive implements OnInit { | |||
64 | this.authService.login(userCreate.username, userCreate.password) | 63 | this.authService.login(userCreate.username, userCreate.password) |
65 | .subscribe( | 64 | .subscribe( |
66 | () => { | 65 | () => { |
67 | this.notificationsService.success( | 66 | this.notifier.success(this.i18n('You are now logged in as {{username}}!', { username: userCreate.username })) |
68 | this.i18n('Success'), | ||
69 | this.i18n('You are now logged in as {{username}}!', { username: userCreate.username }) | ||
70 | ) | ||
71 | 67 | ||
72 | this.redirectService.redirectToHomepage() | 68 | this.redirectService.redirectToHomepage() |
73 | }, | 69 | }, |
diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.ts b/client/src/app/videos/+video-edit/shared/video-edit.component.ts index 1d35b4ba8..85e015901 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, Input, OnDestroy, OnInit, ViewChild } from '@angular/core' | |||
2 | import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' | 2 | import { FormArray, FormControl, FormGroup, ValidatorFn, Validators } from '@angular/forms' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' | 4 | import { FormReactiveValidationMessages, VideoValidatorsService } from '@app/shared' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { Notifier } from '@app/core' |
6 | import { ServerService } from '../../../core/server' | 6 | import { ServerService } from '../../../core/server' |
7 | import { VideoEdit } from '../../../shared/video/video-edit.model' | 7 | import { VideoEdit } from '../../../shared/video/video-edit.model' |
8 | import { map } from 'rxjs/operators' | 8 | import { map } from 'rxjs/operators' |
@@ -59,7 +59,7 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
59 | private videoCaptionService: VideoCaptionService, | 59 | private videoCaptionService: VideoCaptionService, |
60 | private route: ActivatedRoute, | 60 | private route: ActivatedRoute, |
61 | private router: Router, | 61 | private router: Router, |
62 | private notificationsService: NotificationsService, | 62 | private notifier: Notifier, |
63 | private serverService: ServerService, | 63 | private serverService: ServerService, |
64 | private i18nPrimengCalendarService: I18nPrimengCalendarService | 64 | private i18nPrimengCalendarService: I18nPrimengCalendarService |
65 | ) { | 65 | ) { |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index 13776ae36..63db06919 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | ||
4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 3 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' |
5 | import { AuthService, ServerService } from '../../../core' | 4 | import { AuthService, Notifier, ServerService } from '../../../core' |
6 | import { VideoService } from '../../../shared/video/video.service' | 5 | import { VideoService } from '../../../shared/video/video.service' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
@@ -41,7 +40,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
41 | constructor ( | 40 | constructor ( |
42 | protected formValidatorService: FormValidatorService, | 41 | protected formValidatorService: FormValidatorService, |
43 | protected loadingBar: LoadingBarService, | 42 | protected loadingBar: LoadingBarService, |
44 | protected notificationsService: NotificationsService, | 43 | protected notifier: Notifier, |
45 | protected authService: AuthService, | 44 | protected authService: AuthService, |
46 | protected serverService: ServerService, | 45 | protected serverService: ServerService, |
47 | protected videoService: VideoService, | 46 | protected videoService: VideoService, |
@@ -107,7 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
107 | this.loadingBar.complete() | 106 | this.loadingBar.complete() |
108 | this.isImportingVideo = false | 107 | this.isImportingVideo = false |
109 | this.firstStepError.emit() | 108 | this.firstStepError.emit() |
110 | this.notificationsService.error(this.i18n('Error'), err.message) | 109 | this.notifier.error(err.message) |
111 | } | 110 | } |
112 | ) | 111 | ) |
113 | } | 112 | } |
@@ -126,7 +125,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
126 | .subscribe( | 125 | .subscribe( |
127 | () => { | 126 | () => { |
128 | this.isUpdatingVideo = false | 127 | this.isUpdatingVideo = false |
129 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) | 128 | this.notifier.success(this.i18n('Video to import updated.')) |
130 | 129 | ||
131 | this.router.navigate([ '/my-account', 'video-imports' ]) | 130 | this.router.navigate([ '/my-account', 'video-imports' ]) |
132 | }, | 131 | }, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts index 9cdface75..a1810b7a0 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | ||
4 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' | 3 | import { VideoPrivacy, VideoUpdate } from '../../../../../../shared/models/videos' |
5 | import { AuthService, ServerService } from '../../../core' | 4 | import { AuthService, Notifier, ServerService } from '../../../core' |
6 | import { VideoService } from '../../../shared/video/video.service' | 5 | import { VideoService } from '../../../shared/video/video.service' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 6 | import { I18n } from '@ngx-translate/i18n-polyfill' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
@@ -40,7 +39,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
40 | constructor ( | 39 | constructor ( |
41 | protected formValidatorService: FormValidatorService, | 40 | protected formValidatorService: FormValidatorService, |
42 | protected loadingBar: LoadingBarService, | 41 | protected loadingBar: LoadingBarService, |
43 | protected notificationsService: NotificationsService, | 42 | protected notifier: Notifier, |
44 | protected authService: AuthService, | 43 | protected authService: AuthService, |
45 | protected serverService: ServerService, | 44 | protected serverService: ServerService, |
46 | protected videoService: VideoService, | 45 | protected videoService: VideoService, |
@@ -99,7 +98,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
99 | this.loadingBar.complete() | 98 | this.loadingBar.complete() |
100 | this.isImportingVideo = false | 99 | this.isImportingVideo = false |
101 | this.firstStepError.emit() | 100 | this.firstStepError.emit() |
102 | this.notificationsService.error(this.i18n('Error'), err.message) | 101 | this.notifier.error(err.message) |
103 | } | 102 | } |
104 | ) | 103 | ) |
105 | } | 104 | } |
@@ -118,7 +117,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
118 | .subscribe( | 117 | .subscribe( |
119 | () => { | 118 | () => { |
120 | this.isUpdatingVideo = false | 119 | this.isUpdatingVideo = false |
121 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video to import updated.')) | 120 | this.notifier.success(this.i18n('Video to import updated.')) |
122 | 121 | ||
123 | this.router.navigate([ '/my-account', 'video-imports' ]) | 122 | this.router.navigate([ '/my-account', 'video-imports' ]) |
124 | }, | 123 | }, |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-send.ts b/client/src/app/videos/+video-edit/video-add-components/video-send.ts index 71d2544d8..580c123a0 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-send.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-send.ts | |||
@@ -1,10 +1,9 @@ | |||
1 | import { EventEmitter, OnInit } from '@angular/core' | 1 | import { EventEmitter, OnInit } from '@angular/core' |
2 | import { LoadingBarService } from '@ngx-loading-bar/core' | 2 | import { LoadingBarService } from '@ngx-loading-bar/core' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { catchError, switchMap, tap } from 'rxjs/operators' | 4 | import { catchError, switchMap, tap } from 'rxjs/operators' |
5 | import { FormReactive } from '@app/shared' | 5 | import { FormReactive } from '@app/shared' |
6 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' | 6 | import { VideoConstant, VideoPrivacy } from '../../../../../../shared' |
7 | import { AuthService, ServerService } from '@app/core' | ||
8 | import { VideoService } from '@app/shared/video/video.service' | 7 | import { VideoService } from '@app/shared/video/video.service' |
9 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' | 8 | import { VideoCaptionEdit } from '@app/shared/video-caption/video-caption-edit.model' |
10 | import { VideoCaptionService } from '@app/shared/video-caption' | 9 | import { VideoCaptionService } from '@app/shared/video-caption' |
@@ -25,7 +24,7 @@ export abstract class VideoSend extends FormReactive implements OnInit { | |||
25 | protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy | 24 | protected abstract readonly DEFAULT_VIDEO_PRIVACY: VideoPrivacy |
26 | 25 | ||
27 | protected loadingBar: LoadingBarService | 26 | protected loadingBar: LoadingBarService |
28 | protected notificationsService: NotificationsService | 27 | protected notifier: Notifier |
29 | protected authService: AuthService | 28 | protected authService: AuthService |
30 | protected serverService: ServerService | 29 | protected serverService: ServerService |
31 | protected videoService: VideoService | 30 | protected videoService: VideoService |
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts index 2180e22ab..aa40f8781 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -2,11 +2,10 @@ import { HttpEventType, HttpResponse } from '@angular/common/http' | |||
2 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' | 2 | import { Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core' |
3 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { BytesPipe } from 'ngx-pipes' | 5 | import { BytesPipe } from 'ngx-pipes' |
7 | import { Subscription } from 'rxjs' | 6 | import { Subscription } from 'rxjs' |
8 | import { VideoPrivacy } from '../../../../../../shared/models/videos' | 7 | import { VideoPrivacy } from '../../../../../../shared/models/videos' |
9 | import { AuthService, ServerService } from '../../../core' | 8 | import { AuthService, Notifier, ServerService } from '../../../core' |
10 | import { VideoEdit } from '../../../shared/video/video-edit.model' | 9 | import { VideoEdit } from '../../../shared/video/video-edit.model' |
11 | import { VideoService } from '../../../shared/video/video.service' | 10 | import { VideoService } from '../../../shared/video/video.service' |
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | 11 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -53,7 +52,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
53 | constructor ( | 52 | constructor ( |
54 | protected formValidatorService: FormValidatorService, | 53 | protected formValidatorService: FormValidatorService, |
55 | protected loadingBar: LoadingBarService, | 54 | protected loadingBar: LoadingBarService, |
56 | protected notificationsService: NotificationsService, | 55 | protected notifier: Notifier, |
57 | protected authService: AuthService, | 56 | protected authService: AuthService, |
58 | protected serverService: ServerService, | 57 | protected serverService: ServerService, |
59 | protected videoService: VideoService, | 58 | protected videoService: VideoService, |
@@ -110,7 +109,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
110 | this.isUploadingVideo = false | 109 | this.isUploadingVideo = false |
111 | this.videoUploadPercents = 0 | 110 | this.videoUploadPercents = 0 |
112 | this.videoUploadObservable = null | 111 | this.videoUploadObservable = null |
113 | this.notificationsService.info(this.i18n('Info'), this.i18n('Upload cancelled')) | 112 | this.notifier.info(this.i18n('Upload cancelled')) |
114 | } | 113 | } |
115 | } | 114 | } |
116 | 115 | ||
@@ -130,7 +129,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
130 | videoQuota: bytePipes.transform(videoQuota, 0) | 129 | videoQuota: bytePipes.transform(videoQuota, 0) |
131 | } | 130 | } |
132 | ) | 131 | ) |
133 | this.notificationsService.error(this.i18n('Error'), msg) | 132 | this.notifier.error(msg) |
134 | return | 133 | return |
135 | } | 134 | } |
136 | 135 | ||
@@ -145,7 +144,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
145 | quotaDaily: bytePipes.transform(videoQuotaDaily, 0) | 144 | quotaDaily: bytePipes.transform(videoQuotaDaily, 0) |
146 | } | 145 | } |
147 | ) | 146 | ) |
148 | this.notificationsService.error(this.i18n('Error'), msg) | 147 | this.notifier.error(msg) |
149 | return | 148 | return |
150 | } | 149 | } |
151 | 150 | ||
@@ -209,7 +208,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
209 | this.videoUploadPercents = 0 | 208 | this.videoUploadPercents = 0 |
210 | this.videoUploadObservable = null | 209 | this.videoUploadObservable = null |
211 | this.firstStepError.emit() | 210 | this.firstStepError.emit() |
212 | this.notificationsService.error(this.i18n('Error'), err.message) | 211 | this.notifier.error(err.message) |
213 | } | 212 | } |
214 | ) | 213 | ) |
215 | } | 214 | } |
@@ -238,7 +237,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
238 | this.isUpdatingVideo = false | 237 | this.isUpdatingVideo = false |
239 | this.isUploadingVideo = false | 238 | this.isUploadingVideo = false |
240 | 239 | ||
241 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video published.')) | 240 | this.notifier.success(this.i18n('Video published.')) |
242 | this.router.navigate([ '/videos/watch', video.uuid ]) | 241 | this.router.navigate([ '/videos/watch', video.uuid ]) |
243 | }, | 242 | }, |
244 | 243 | ||
diff --git a/client/src/app/videos/+video-edit/video-update.component.ts b/client/src/app/videos/+video-edit/video-update.component.ts index d99a02b18..d22ee540a 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts | |||
@@ -2,7 +2,7 @@ import { map, switchMap } from 'rxjs/operators' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ActivatedRoute, Router } from '@angular/router' | 3 | import { ActivatedRoute, Router } from '@angular/router' |
4 | import { LoadingBarService } from '@ngx-loading-bar/core' | 4 | import { LoadingBarService } from '@ngx-loading-bar/core' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { Notifier } from '@app/core' |
6 | import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' | 6 | import { VideoConstant, VideoPrivacy } from '../../../../../shared/models/videos' |
7 | import { ServerService } from '../../core' | 7 | import { ServerService } from '../../core' |
8 | import { FormReactive } from '../../shared' | 8 | import { FormReactive } from '../../shared' |
@@ -35,7 +35,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
35 | protected formValidatorService: FormValidatorService, | 35 | protected formValidatorService: FormValidatorService, |
36 | private route: ActivatedRoute, | 36 | private route: ActivatedRoute, |
37 | private router: Router, | 37 | private router: Router, |
38 | private notificationsService: NotificationsService, | 38 | private notifier: Notifier, |
39 | private serverService: ServerService, | 39 | private serverService: ServerService, |
40 | private videoService: VideoService, | 40 | private videoService: VideoService, |
41 | private loadingBar: LoadingBarService, | 41 | private loadingBar: LoadingBarService, |
@@ -78,7 +78,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
78 | 78 | ||
79 | err => { | 79 | err => { |
80 | console.error(err) | 80 | console.error(err) |
81 | this.notificationsService.error(this.i18n('Error'), err.message) | 81 | this.notifier.error(err.message) |
82 | } | 82 | } |
83 | ) | 83 | ) |
84 | } | 84 | } |
@@ -121,14 +121,14 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
121 | this.updateDone = true | 121 | this.updateDone = true |
122 | this.isUpdatingVideo = false | 122 | this.isUpdatingVideo = false |
123 | this.loadingBar.complete() | 123 | this.loadingBar.complete() |
124 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.')) | 124 | this.notifier.success(this.i18n('Video updated.')) |
125 | this.router.navigate([ '/videos/watch', this.video.uuid ]) | 125 | this.router.navigate([ '/videos/watch', this.video.uuid ]) |
126 | }, | 126 | }, |
127 | 127 | ||
128 | err => { | 128 | err => { |
129 | this.loadingBar.complete() | 129 | this.loadingBar.complete() |
130 | this.isUpdatingVideo = false | 130 | this.isUpdatingVideo = false |
131 | this.notificationsService.error(this.i18n('Error'), err.message) | 131 | this.notifier.error(err.message) |
132 | console.error(err) | 132 | console.error(err) |
133 | } | 133 | } |
134 | ) | 134 | ) |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index 7f582c950..6b7e62042 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { Notifier } from '@app/core' |
4 | import { Observable } from 'rxjs' | 4 | import { Observable } from 'rxjs' |
5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' |
6 | import { FormReactive } from '../../../shared' | 6 | import { FormReactive } from '../../../shared' |
@@ -36,7 +36,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
36 | constructor ( | 36 | constructor ( |
37 | protected formValidatorService: FormValidatorService, | 37 | protected formValidatorService: FormValidatorService, |
38 | private videoCommentValidatorsService: VideoCommentValidatorsService, | 38 | private videoCommentValidatorsService: VideoCommentValidatorsService, |
39 | private notificationsService: NotificationsService, | 39 | private notifier: Notifier, |
40 | private videoCommentService: VideoCommentService, | 40 | private videoCommentService: VideoCommentService, |
41 | private authService: AuthService, | 41 | private authService: AuthService, |
42 | private modalService: NgbModal, | 42 | private modalService: NgbModal, |
@@ -115,7 +115,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
115 | err => { | 115 | err => { |
116 | this.addingComment = false | 116 | this.addingComment = false |
117 | 117 | ||
118 | this.notificationsService.error(this.i18n('Error'), err.text) | 118 | this.notifier.error(err.text) |
119 | } | 119 | } |
120 | ) | 120 | ) |
121 | } | 121 | } |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index 8850eccd8..957c17bbf 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild, ElementRef } from '@angular/core' | 1 | import { Component, ElementRef, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from '@angular/core' |
2 | import { ActivatedRoute } from '@angular/router' | 2 | import { ActivatedRoute } from '@angular/router' |
3 | import { ConfirmService } from '@app/core' | 3 | import { ConfirmService, Notifier } from '@app/core' |
4 | import { NotificationsService } from 'angular2-notifications' | ||
5 | import { Subscription } from 'rxjs' | 4 | import { Subscription } from 'rxjs' |
6 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' | 5 | import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' |
7 | import { AuthService } from '../../../core/auth' | 6 | import { AuthService } from '../../../core/auth' |
@@ -42,7 +41,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
42 | 41 | ||
43 | constructor ( | 42 | constructor ( |
44 | private authService: AuthService, | 43 | private authService: AuthService, |
45 | private notificationsService: NotificationsService, | 44 | private notifier: Notifier, |
46 | private confirmService: ConfirmService, | 45 | private confirmService: ConfirmService, |
47 | private videoCommentService: VideoCommentService, | 46 | private videoCommentService: VideoCommentService, |
48 | private activatedRoute: ActivatedRoute, | 47 | private activatedRoute: ActivatedRoute, |
@@ -92,7 +91,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
92 | } | 91 | } |
93 | }, | 92 | }, |
94 | 93 | ||
95 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 94 | err => this.notifier.error(err.message) |
96 | ) | 95 | ) |
97 | } | 96 | } |
98 | 97 | ||
@@ -104,7 +103,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
104 | this.componentPagination.totalItems = res.totalComments | 103 | this.componentPagination.totalItems = res.totalComments |
105 | }, | 104 | }, |
106 | 105 | ||
107 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 106 | err => this.notifier.error(err.message) |
108 | ) | 107 | ) |
109 | } | 108 | } |
110 | 109 | ||
@@ -155,7 +154,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
155 | if (this.highlightedThread.id === commentToDelete.id) this.highlightedThread = undefined | 154 | if (this.highlightedThread.id === commentToDelete.id) this.highlightedThread = undefined |
156 | }, | 155 | }, |
157 | 156 | ||
158 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 157 | err => this.notifier.error(err.message) |
159 | ) | 158 | ) |
160 | } | 159 | } |
161 | 160 | ||
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 @@ | |||
1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier, RedirectService } from '@app/core' |
3 | import { FormReactive, VideoBlacklistService, VideoBlacklistValidatorsService } from '../../../shared/index' | 3 | import { FormReactive, VideoBlacklistService, VideoBlacklistValidatorsService } from '../../../shared/index' |
4 | import { VideoDetails } from '../../../shared/video/video-details.model' | 4 | import { VideoDetails } from '../../../shared/video/video-details.model' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | 6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' |
7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 7 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 8 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
9 | import { RedirectService } from '@app/core' | ||
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
12 | selector: 'my-video-blacklist', | 11 | selector: 'my-video-blacklist', |
@@ -27,7 +26,7 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { | |||
27 | private modalService: NgbModal, | 26 | private modalService: NgbModal, |
28 | private videoBlacklistValidatorsService: VideoBlacklistValidatorsService, | 27 | private videoBlacklistValidatorsService: VideoBlacklistValidatorsService, |
29 | private videoBlacklistService: VideoBlacklistService, | 28 | private videoBlacklistService: VideoBlacklistService, |
30 | private notificationsService: NotificationsService, | 29 | private notifier: Notifier, |
31 | private redirectService: RedirectService, | 30 | private redirectService: RedirectService, |
32 | private i18n: I18n | 31 | private i18n: I18n |
33 | ) { | 32 | ) { |
@@ -55,12 +54,12 @@ export class VideoBlacklistComponent extends FormReactive implements OnInit { | |||
55 | this.videoBlacklistService.blacklistVideo(this.video.id, reason) | 54 | this.videoBlacklistService.blacklistVideo(this.video.id, reason) |
56 | .subscribe( | 55 | .subscribe( |
57 | () => { | 56 | () => { |
58 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video blacklisted.')) | 57 | this.notifier.success(this.i18n('Video blacklisted.')) |
59 | this.hide() | 58 | this.hide() |
60 | this.redirectService.redirectToHomepage() | 59 | this.redirectService.redirectToHomepage() |
61 | }, | 60 | }, |
62 | 61 | ||
63 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 62 | err => this.notifier.error(err.message) |
64 | ) | 63 | ) |
65 | } | 64 | } |
66 | } | 65 | } |
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' | |||
2 | import { VideoDetails } from '../../../shared/video/video-details.model' | 2 | import { VideoDetails } from '../../../shared/video/video-details.model' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 4 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { NotificationsService } from 'angular2-notifications' | 5 | import { Notifier } from '@app/core' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'my-video-download', | 8 | selector: 'my-video-download', |
@@ -18,7 +18,7 @@ export class VideoDownloadComponent implements OnInit { | |||
18 | resolutionId: number | string = -1 | 18 | resolutionId: number | string = -1 |
19 | 19 | ||
20 | constructor ( | 20 | constructor ( |
21 | private notificationsService: NotificationsService, | 21 | private notifier: Notifier, |
22 | private modalService: NgbModal, | 22 | private modalService: NgbModal, |
23 | private i18n: I18n | 23 | private i18n: I18n |
24 | ) { } | 24 | ) { } |
@@ -63,6 +63,6 @@ export class VideoDownloadComponent implements OnInit { | |||
63 | } | 63 | } |
64 | 64 | ||
65 | activateCopiedMessage () { | 65 | activateCopiedMessage () { |
66 | this.notificationsService.success(this.i18n('Success'), this.i18n('Copied')) | 66 | this.notifier.success(this.i18n('Copied')) |
67 | } | 67 | } |
68 | } | 68 | } |
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 @@ | |||
1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, Input, OnInit, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { FormReactive, VideoAbuseService } from '../../../shared/index' | 3 | import { FormReactive, VideoAbuseService } from '../../../shared/index' |
4 | import { VideoDetails } from '../../../shared/video/video-details.model' | 4 | import { VideoDetails } from '../../../shared/video/video-details.model' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -27,7 +27,7 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
27 | private modalService: NgbModal, | 27 | private modalService: NgbModal, |
28 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, | 28 | private videoAbuseValidatorsService: VideoAbuseValidatorsService, |
29 | private videoAbuseService: VideoAbuseService, | 29 | private videoAbuseService: VideoAbuseService, |
30 | private notificationsService: NotificationsService, | 30 | private notifier: Notifier, |
31 | private i18n: I18n | 31 | private i18n: I18n |
32 | ) { | 32 | ) { |
33 | super() | 33 | super() |
@@ -66,11 +66,11 @@ export class VideoReportComponent extends FormReactive implements OnInit { | |||
66 | this.videoAbuseService.reportVideo(this.video.id, reason) | 66 | this.videoAbuseService.reportVideo(this.video.id, reason) |
67 | .subscribe( | 67 | .subscribe( |
68 | () => { | 68 | () => { |
69 | this.notificationsService.success(this.i18n('Success'), this.i18n('Video reported.')) | 69 | this.notifier.success(this.i18n('Video reported.')) |
70 | this.hide() | 70 | this.hide() |
71 | }, | 71 | }, |
72 | 72 | ||
73 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 73 | err => this.notifier.error(err.message) |
74 | ) | 74 | ) |
75 | } | 75 | } |
76 | 76 | ||
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 @@ | |||
1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, Input, ViewChild } from '@angular/core' |
2 | import { NotificationsService } from 'angular2-notifications' | 2 | import { Notifier } from '@app/core' |
3 | import { VideoDetails } from '../../../shared/video/video-details.model' | 3 | import { VideoDetails } from '../../../shared/video/video-details.model' |
4 | import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' | 4 | import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { I18n } from '@ngx-translate/i18n-polyfill' |
@@ -23,7 +23,7 @@ export class VideoShareComponent { | |||
23 | 23 | ||
24 | constructor ( | 24 | constructor ( |
25 | private modalService: NgbModal, | 25 | private modalService: NgbModal, |
26 | private notificationsService: NotificationsService, | 26 | private notifier: Notifier, |
27 | private i18n: I18n | 27 | private i18n: I18n |
28 | ) { } | 28 | ) { } |
29 | 29 | ||
@@ -49,7 +49,7 @@ export class VideoShareComponent { | |||
49 | } | 49 | } |
50 | 50 | ||
51 | activateCopiedMessage () { | 51 | activateCopiedMessage () { |
52 | this.notificationsService.success(this.i18n('Success'), this.i18n('Copied')) | 52 | this.notifier.success(this.i18n('Copied')) |
53 | } | 53 | } |
54 | 54 | ||
55 | getStartCheckboxLabel () { | 55 | getStartCheckboxLabel () { |
diff --git a/client/src/app/videos/+video-watch/video-watch.component.ts b/client/src/app/videos/+video-watch/video-watch.component.ts index ef0f685c6..7765c4660 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts | |||
@@ -5,7 +5,7 @@ import { RedirectService } from '@app/core/routing/redirect.service' | |||
5 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' | 5 | import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' |
6 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' | 6 | import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' |
7 | import { MetaService } from '@ngx-meta/core' | 7 | import { MetaService } from '@ngx-meta/core' |
8 | import { NotificationsService } from 'angular2-notifications' | 8 | import { Notifier, ServerService } from '@app/core' |
9 | import { forkJoin, Subscription } from 'rxjs' | 9 | import { forkJoin, Subscription } from 'rxjs' |
10 | // FIXME: something weird with our path definition in tsconfig and typings | 10 | // FIXME: something weird with our path definition in tsconfig and typings |
11 | // @ts-ignore | 11 | // @ts-ignore |
@@ -13,7 +13,7 @@ import videojs from 'video.js' | |||
13 | import 'videojs-hotkeys' | 13 | import 'videojs-hotkeys' |
14 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 14 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
15 | import * as WebTorrent from 'webtorrent' | 15 | import * as WebTorrent from 'webtorrent' |
16 | import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoRateType, VideoState } from '../../../../../shared' | 16 | import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' |
17 | import '../../../assets/player/peertube-videojs-plugin' | 17 | import '../../../assets/player/peertube-videojs-plugin' |
18 | import { AuthService, ConfirmService } from '../../core' | 18 | import { AuthService, ConfirmService } from '../../core' |
19 | import { RestExtractor, VideoBlacklistService } from '../../shared' | 19 | import { RestExtractor, VideoBlacklistService } from '../../shared' |
@@ -26,7 +26,6 @@ import { VideoShareComponent } from './modal/video-share.component' | |||
26 | import { VideoBlacklistComponent } from './modal/video-blacklist.component' | 26 | import { VideoBlacklistComponent } from './modal/video-blacklist.component' |
27 | import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' | 27 | import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' |
28 | import { addContextMenu, getVideojsOptions, loadLocaleInVideoJS } from '../../../assets/player/peertube-player' | 28 | import { addContextMenu, getVideojsOptions, loadLocaleInVideoJS } from '../../../assets/player/peertube-player' |
29 | import { ServerService } from '@app/core' | ||
30 | import { I18n } from '@ngx-translate/i18n-polyfill' | 29 | import { I18n } from '@ngx-translate/i18n-polyfill' |
31 | import { environment } from '../../../environments/environment' | 30 | import { environment } from '../../../environments/environment' |
32 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' | 31 | import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' |
@@ -77,7 +76,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
77 | private authService: AuthService, | 76 | private authService: AuthService, |
78 | private serverService: ServerService, | 77 | private serverService: ServerService, |
79 | private restExtractor: RestExtractor, | 78 | private restExtractor: RestExtractor, |
80 | private notificationsService: NotificationsService, | 79 | private notifier: Notifier, |
81 | private markdownService: MarkdownService, | 80 | private markdownService: MarkdownService, |
82 | private zone: NgZone, | 81 | private zone: NgZone, |
83 | private redirectService: RedirectService, | 82 | private redirectService: RedirectService, |
@@ -205,7 +204,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
205 | 204 | ||
206 | error => { | 205 | error => { |
207 | this.descriptionLoading = false | 206 | this.descriptionLoading = false |
208 | this.notificationsService.error(this.i18n('Error'), error.message) | 207 | this.notifier.error(error.message) |
209 | } | 208 | } |
210 | ) | 209 | ) |
211 | } | 210 | } |
@@ -247,16 +246,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
247 | 246 | ||
248 | this.videoBlacklistService.removeVideoFromBlacklist(this.video.id).subscribe( | 247 | this.videoBlacklistService.removeVideoFromBlacklist(this.video.id).subscribe( |
249 | () => { | 248 | () => { |
250 | this.notificationsService.success( | 249 | this.notifier.success(this.i18n('Video {{name}} removed from the blacklist.', { name: this.video.name })) |
251 | this.i18n('Success'), | ||
252 | this.i18n('Video {{name}} removed from the blacklist.', { name: this.video.name }) | ||
253 | ) | ||
254 | 250 | ||
255 | this.video.blacklisted = false | 251 | this.video.blacklisted = false |
256 | this.video.blacklistedReason = null | 252 | this.video.blacklistedReason = null |
257 | }, | 253 | }, |
258 | 254 | ||
259 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 255 | err => this.notifier.error(err.message) |
260 | ) | 256 | ) |
261 | } | 257 | } |
262 | 258 | ||
@@ -294,17 +290,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
294 | 290 | ||
295 | this.videoService.removeVideo(this.video.id) | 291 | this.videoService.removeVideo(this.video.id) |
296 | .subscribe( | 292 | .subscribe( |
297 | status => { | 293 | () => { |
298 | this.notificationsService.success( | 294 | this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name })) |
299 | this.i18n('Success'), | ||
300 | this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name }) | ||
301 | ) | ||
302 | 295 | ||
303 | // Go back to the video-list. | 296 | // Go back to the video-list. |
304 | this.redirectService.redirectToHomepage() | 297 | this.redirectService.redirectToHomepage() |
305 | }, | 298 | }, |
306 | 299 | ||
307 | error => this.notificationsService.error(this.i18n('Error'), error.message) | 300 | error => this.notifier.error(error.message) |
308 | ) | 301 | ) |
309 | } | 302 | } |
310 | 303 | ||
@@ -354,7 +347,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
354 | return | 347 | return |
355 | } | 348 | } |
356 | 349 | ||
357 | this.notificationsService.error(this.i18n('Error'), errorMessage) | 350 | this.notifier.error(errorMessage) |
358 | } | 351 | } |
359 | 352 | ||
360 | private checkUserRating () { | 353 | private checkUserRating () { |
@@ -369,7 +362,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
369 | } | 362 | } |
370 | }, | 363 | }, |
371 | 364 | ||
372 | err => this.notificationsService.error(this.i18n('Error'), err.message) | 365 | err => this.notifier.error(err.message) |
373 | ) | 366 | ) |
374 | } | 367 | } |
375 | 368 | ||
@@ -475,7 +468,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
475 | this.userRating = nextRating | 468 | this.userRating = nextRating |
476 | }, | 469 | }, |
477 | 470 | ||
478 | (err: { message: string }) => this.notificationsService.error(this.i18n('Error'), err.message) | 471 | (err: { message: string }) => this.notifier.error(err.message) |
479 | ) | 472 | ) |
480 | } | 473 | } |
481 | 474 | ||
diff --git a/client/src/app/videos/video-list/video-local.component.ts b/client/src/app/videos/video-list/video-local.component.ts index 9d000cf2e..c0be4b885 100644 --- a/client/src/app/videos/video-list/video-local.component.ts +++ b/client/src/app/videos/video-list/video-local.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { Location } from '@angular/common' | 4 | import { Location } from '@angular/common' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
8 | import { VideoSortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
@@ -11,6 +10,7 @@ import { VideoFilter } from '../../../../../shared/models/videos/video-query.typ | |||
11 | import { I18n } from '@ngx-translate/i18n-polyfill' | 10 | import { I18n } from '@ngx-translate/i18n-polyfill' |
12 | import { ScreenService } from '@app/shared/misc/screen.service' | 11 | import { ScreenService } from '@app/shared/misc/screen.service' |
13 | import { UserRight } from '../../../../../shared/models/users' | 12 | import { UserRight } from '../../../../../shared/models/users' |
13 | import { Notifier } from '@app/core' | ||
14 | 14 | ||
15 | @Component({ | 15 | @Component({ |
16 | selector: 'my-videos-local', | 16 | selector: 'my-videos-local', |
@@ -26,7 +26,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
26 | constructor ( | 26 | constructor ( |
27 | protected router: Router, | 27 | protected router: Router, |
28 | protected route: ActivatedRoute, | 28 | protected route: ActivatedRoute, |
29 | protected notificationsService: NotificationsService, | 29 | protected notifier: Notifier, |
30 | protected authService: AuthService, | 30 | protected authService: AuthService, |
31 | protected location: Location, | 31 | protected location: Location, |
32 | protected i18n: I18n, | 32 | protected i18n: I18n, |
diff --git a/client/src/app/videos/video-list/video-overview.component.ts b/client/src/app/videos/video-list/video-overview.component.ts index 2c6054721..7ff52b259 100644 --- a/client/src/app/videos/video-list/video-overview.component.ts +++ b/client/src/app/videos/video-list/video-overview.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService } from '@app/core' | 2 | import { AuthService, Notifier } from '@app/core' |
3 | import { NotificationsService } from 'angular2-notifications' | ||
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | 3 | import { I18n } from '@ngx-translate/i18n-polyfill' |
5 | import { VideosOverview } from '@app/shared/overview/videos-overview.model' | 4 | import { VideosOverview } from '@app/shared/overview/videos-overview.model' |
6 | import { OverviewService } from '@app/shared/overview' | 5 | import { OverviewService } from '@app/shared/overview' |
@@ -21,7 +20,7 @@ export class VideoOverviewComponent implements OnInit { | |||
21 | 20 | ||
22 | constructor ( | 21 | constructor ( |
23 | private i18n: I18n, | 22 | private i18n: I18n, |
24 | private notificationsService: NotificationsService, | 23 | private notifier: Notifier, |
25 | private authService: AuthService, | 24 | private authService: AuthService, |
26 | private overviewService: OverviewService | 25 | private overviewService: OverviewService |
27 | ) { } | 26 | ) { } |
@@ -43,10 +42,7 @@ export class VideoOverviewComponent implements OnInit { | |||
43 | ) this.notResults = true | 42 | ) this.notResults = true |
44 | }, | 43 | }, |
45 | 44 | ||
46 | err => { | 45 | err => this.notifier.error(err.message) |
47 | console.log(err) | ||
48 | this.notificationsService.error('Error', err.text) | ||
49 | } | ||
50 | ) | 46 | ) |
51 | } | 47 | } |
52 | 48 | ||
diff --git a/client/src/app/videos/video-list/video-recently-added.component.ts b/client/src/app/videos/video-list/video-recently-added.component.ts index ac1fcfff3..f99c8abb6 100644 --- a/client/src/app/videos/video-list/video-recently-added.component.ts +++ b/client/src/app/videos/video-list/video-recently-added.component.ts | |||
@@ -2,13 +2,13 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { Location } from '@angular/common' | 3 | import { Location } from '@angular/common' |
4 | import { immutableAssign } from '@app/shared/misc/utils' | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
8 | import { VideoSortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
9 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { ScreenService } from '@app/shared/misc/screen.service' | 10 | import { ScreenService } from '@app/shared/misc/screen.service' |
11 | import { Notifier } from '@app/core' | ||
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
14 | selector: 'my-videos-recently-added', | 14 | selector: 'my-videos-recently-added', |
@@ -24,7 +24,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
24 | protected router: Router, | 24 | protected router: Router, |
25 | protected route: ActivatedRoute, | 25 | protected route: ActivatedRoute, |
26 | protected location: Location, | 26 | protected location: Location, |
27 | protected notificationsService: NotificationsService, | 27 | protected notifier: Notifier, |
28 | protected authService: AuthService, | 28 | protected authService: AuthService, |
29 | protected i18n: I18n, | 29 | protected i18n: I18n, |
30 | protected screenService: ScreenService, | 30 | protected screenService: ScreenService, |
diff --git a/client/src/app/videos/video-list/video-trending.component.ts b/client/src/app/videos/video-list/video-trending.component.ts index 8f3d3842b..accc5bfe5 100644 --- a/client/src/app/videos/video-list/video-trending.component.ts +++ b/client/src/app/videos/video-list/video-trending.component.ts | |||
@@ -2,13 +2,13 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { Location } from '@angular/common' | 3 | import { Location } from '@angular/common' |
4 | import { immutableAssign } from '@app/shared/misc/utils' | 4 | import { immutableAssign } from '@app/shared/misc/utils' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
8 | import { VideoSortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
9 | import { VideoService } from '../../shared/video/video.service' | 8 | import { VideoService } from '../../shared/video/video.service' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { ScreenService } from '@app/shared/misc/screen.service' | 10 | import { ScreenService } from '@app/shared/misc/screen.service' |
11 | import { Notifier } from '@app/core' | ||
12 | 12 | ||
13 | @Component({ | 13 | @Component({ |
14 | selector: 'my-videos-trending', | 14 | selector: 'my-videos-trending', |
@@ -23,7 +23,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
23 | constructor ( | 23 | constructor ( |
24 | protected router: Router, | 24 | protected router: Router, |
25 | protected route: ActivatedRoute, | 25 | protected route: ActivatedRoute, |
26 | protected notificationsService: NotificationsService, | 26 | protected notifier: Notifier, |
27 | protected authService: AuthService, | 27 | protected authService: AuthService, |
28 | protected location: Location, | 28 | protected location: Location, |
29 | protected screenService: ScreenService, | 29 | protected screenService: ScreenService, |
diff --git a/client/src/app/videos/video-list/video-user-subscriptions.component.ts b/client/src/app/videos/video-list/video-user-subscriptions.component.ts index 6e8959c54..bee828e12 100644 --- a/client/src/app/videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/videos/video-list/video-user-subscriptions.component.ts | |||
@@ -2,7 +2,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
2 | import { ActivatedRoute, Router } from '@angular/router' | 2 | import { ActivatedRoute, Router } from '@angular/router' |
3 | import { immutableAssign } from '@app/shared/misc/utils' | 3 | import { immutableAssign } from '@app/shared/misc/utils' |
4 | import { Location } from '@angular/common' | 4 | import { Location } from '@angular/common' |
5 | import { NotificationsService } from 'angular2-notifications' | ||
6 | import { AuthService } from '../../core/auth' | 5 | import { AuthService } from '../../core/auth' |
7 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' | 6 | import { AbstractVideoList } from '../../shared/video/abstract-video-list' |
8 | import { VideoSortField } from '../../shared/video/sort-field.type' | 7 | import { VideoSortField } from '../../shared/video/sort-field.type' |
@@ -10,6 +9,7 @@ import { VideoService } from '../../shared/video/video.service' | |||
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { I18n } from '@ngx-translate/i18n-polyfill' |
11 | import { ScreenService } from '@app/shared/misc/screen.service' | 10 | import { ScreenService } from '@app/shared/misc/screen.service' |
12 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | 11 | import { OwnerDisplayType } from '@app/shared/video/video-miniature.component' |
12 | import { Notifier } from '@app/core' | ||
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
15 | selector: 'my-videos-user-subscriptions', | 15 | selector: 'my-videos-user-subscriptions', |
@@ -25,7 +25,7 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
25 | constructor ( | 25 | constructor ( |
26 | protected router: Router, | 26 | protected router: Router, |
27 | protected route: ActivatedRoute, | 27 | protected route: ActivatedRoute, |
28 | protected notificationsService: NotificationsService, | 28 | protected notifier: Notifier, |
29 | protected authService: AuthService, | 29 | protected authService: AuthService, |
30 | protected location: Location, | 30 | protected location: Location, |
31 | protected i18n: I18n, | 31 | protected i18n: I18n, |
diff --git a/client/src/sass/primeng-custom.scss b/client/src/sass/primeng-custom.scss index 1d6eebcfa..21452fa16 100644 --- a/client/src/sass/primeng-custom.scss +++ b/client/src/sass/primeng-custom.scss | |||
@@ -299,3 +299,48 @@ p-inputswitch { | |||
299 | background-color: var(--mainColor) !important; | 299 | background-color: var(--mainColor) !important; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | |||
303 | p-toast { | ||
304 | .ui-toast-message { | ||
305 | font-family: $main-fonts; | ||
306 | |||
307 | &.ui-toast-message-success { | ||
308 | color: #fff !important; | ||
309 | background-color: #8BC34A !important; | ||
310 | } | ||
311 | |||
312 | &.ui-toast-message-error { | ||
313 | color: #fff !important; | ||
314 | background-color: #F44336 !important; | ||
315 | } | ||
316 | |||
317 | &.ui-toast-message-info { | ||
318 | color: #fff !important; | ||
319 | background-color: #03A9F4 !important; | ||
320 | } | ||
321 | |||
322 | &.ui-toast-message-info { | ||
323 | color: #fff !important; | ||
324 | background-color: #03A9F4 !important; | ||
325 | } | ||
326 | |||
327 | .message { | ||
328 | float: left; | ||
329 | |||
330 | h3 { | ||
331 | font-size: 21px; | ||
332 | } | ||
333 | |||
334 | p { | ||
335 | font-size: 15px; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | .glyphicon { | ||
340 | float: right; | ||
341 | font-size: 32px; | ||
342 | margin-top: 15px; | ||
343 | margin-right: 5px; | ||
344 | } | ||
345 | } | ||
346 | } | ||
diff --git a/client/yarn.lock b/client/yarn.lock index 98a30941e..3c7ba2d25 100644 --- a/client/yarn.lock +++ b/client/yarn.lock | |||
@@ -999,11 +999,6 @@ angular2-hotkeys@^2.1.2: | |||
999 | "@types/mousetrap" "^1.6.0" | 999 | "@types/mousetrap" "^1.6.0" |
1000 | mousetrap "^1.6.0" | 1000 | mousetrap "^1.6.0" |
1001 | 1001 | ||
1002 | angular2-notifications@^1.0.2: | ||
1003 | version "1.0.4" | ||
1004 | resolved "https://registry.yarnpkg.com/angular2-notifications/-/angular2-notifications-1.0.4.tgz#7b3c449dbad45503965f8cd8ac00e998a4463544" | ||
1005 | integrity sha512-DjazfwXtLY8BNXKIEw1oEEMy7G6fmldpzP1FYwyVGUwEtZPLQyYGu9MQYCjtVlZMljxpa3qvnv8l9ZUfXAarNA== | ||
1006 | |||
1007 | ansi-colors@^3.0.0: | 1002 | ansi-colors@^3.0.0: |
1008 | version "3.2.2" | 1003 | version "3.2.2" |
1009 | resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.2.tgz#e49349137dbeb6d381b91e607c189915e53265ba" | 1004 | resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.2.tgz#e49349137dbeb6d381b91e607c189915e53265ba" |