diff options
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/video-watch.component.ts | 31 |
1 files changed, 12 insertions, 19 deletions
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 | ||