aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-19 16:04:34 +0100
committerChocobozzz <me@florianbigard.com>2018-12-19 17:26:52 +0100
commitf8b2c1b4f509c037b9650cca2c5befd21f056df3 (patch)
tree89d278f9628d657e6aad1b1e15febaf8ff9fcfa9 /client/src/app/videos/+video-watch/video-watch.component.ts
parente0e665f0efa98f2701dd9f5529e99989680481ae (diff)
downloadPeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.gz
PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.tar.zst
PeerTube-f8b2c1b4f509c037b9650cca2c5befd21f056df3.zip
Refractor notification service
Shorter name and use primeng component
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts31
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'
5import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' 5import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
6import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' 6import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component'
7import { MetaService } from '@ngx-meta/core' 7import { MetaService } from '@ngx-meta/core'
8import { NotificationsService } from 'angular2-notifications' 8import { Notifier, ServerService } from '@app/core'
9import { forkJoin, Subscription } from 'rxjs' 9import { 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'
13import 'videojs-hotkeys' 13import 'videojs-hotkeys'
14import { Hotkey, HotkeysService } from 'angular2-hotkeys' 14import { Hotkey, HotkeysService } from 'angular2-hotkeys'
15import * as WebTorrent from 'webtorrent' 15import * as WebTorrent from 'webtorrent'
16import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoRateType, VideoState } from '../../../../../shared' 16import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
17import '../../../assets/player/peertube-videojs-plugin' 17import '../../../assets/player/peertube-videojs-plugin'
18import { AuthService, ConfirmService } from '../../core' 18import { AuthService, ConfirmService } from '../../core'
19import { RestExtractor, VideoBlacklistService } from '../../shared' 19import { RestExtractor, VideoBlacklistService } from '../../shared'
@@ -26,7 +26,6 @@ import { VideoShareComponent } from './modal/video-share.component'
26import { VideoBlacklistComponent } from './modal/video-blacklist.component' 26import { VideoBlacklistComponent } from './modal/video-blacklist.component'
27import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component' 27import { SubscribeButtonComponent } from '@app/shared/user-subscription/subscribe-button.component'
28import { addContextMenu, getVideojsOptions, loadLocaleInVideoJS } from '../../../assets/player/peertube-player' 28import { addContextMenu, getVideojsOptions, loadLocaleInVideoJS } from '../../../assets/player/peertube-player'
29import { ServerService } from '@app/core'
30import { I18n } from '@ngx-translate/i18n-polyfill' 29import { I18n } from '@ngx-translate/i18n-polyfill'
31import { environment } from '../../../environments/environment' 30import { environment } from '../../../environments/environment'
32import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' 31import { 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