X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-watch%2Fvideo-watch.component.ts;h=f1f19476483f29455b5f571e388cb21b289c6357;hb=cbca00dfc14fe47260e8d081f4ed0bec7c66fd09;hp=df4cfa66687b9c2a48f36097867323036fd3b476;hpb=6725d05c5f71e0cdf0deba6692220b73e42e7ffa;p=github%2FChocobozzz%2FPeerTube.git 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 df4cfa666..f1f194764 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -14,9 +14,9 @@ import { VideoDetails } from '../../shared/video/video-details.model' import { Video } from '../../shared/video/video.model' import { VideoService } from '../../shared/video/video.service' import { MarkdownService } from '../shared' -import { VideoDownloadComponent } from './video-download.component' -import { VideoReportComponent } from './video-report.component' -import { VideoShareComponent } from './video-share.component' +import { VideoDownloadComponent } from './modal/video-download.component' +import { VideoReportComponent } from './modal/video-report.component' +import { VideoShareComponent } from './modal/video-share.component' @Component({ selector: 'my-video-watch', @@ -44,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { completeVideoDescription: string shortVideoDescription: string videoHTMLDescription = '' + likesBarTooltipText = '' private paramsSub: Subscription @@ -136,7 +137,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { blacklistVideo (event: Event) { event.preventDefault() - this.confirmService.confirm('Do you really want to blacklist this video ?', 'Blacklist').subscribe( + this.confirmService.confirm('Do you really want to blacklist this video?', 'Blacklist').subscribe( res => { if (res === false) return @@ -147,7 +148,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.router.navigate(['/videos/list']) }, - error => this.notificationsService.error('Error', error.text) + error => this.notificationsService.error('Error', error.message) ) } ) @@ -184,7 +185,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { error => { this.descriptionLoading = false - this.notificationsService.error('Error', error.text) + this.notificationsService.error('Error', error.message) } ) } @@ -207,12 +208,16 @@ export class VideoWatchComponent implements OnInit, OnDestroy { return this.authService.isLoggedIn() } + isVideoUpdatable () { + return this.video.isUpdatableBy(this.authService.getUser()) + } + isVideoBlacklistable () { return this.video.isBlackistableBy(this.user) } getAvatarPath () { - return Account.GET_ACCOUNT_AVATAR_PATH(this.video.account) + return Account.GET_ACCOUNT_AVATAR_URL(this.video.account) } getVideoTags () { @@ -228,23 +233,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy { removeVideo (event: Event) { event.preventDefault() - this.confirmService.confirm('Do you really want to delete this video?', 'Delete').subscribe( - res => { - if (res === false) return + this.confirmService.confirm('Do you really want to delete this video?', 'Delete') + .subscribe( + res => { + if (res === false) return - this.videoService.removeVideo(this.video.id) - .subscribe( - status => { - this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) + this.videoService.removeVideo(this.video.id) + .subscribe( + status => { + this.notificationsService.success('Success', `Video ${this.video.name} deleted.`) - // Go back to the video-list. - this.router.navigate([ '/videos/list' ]) - }, + // Go back to the video-list. + this.router.navigate([ '/videos/list' ]) + }, - error => this.notificationsService.error('Error', error.text) - ) - } - ) + error => this.notificationsService.error('Error', error.message) + ) + } + ) } private updateVideoDescription (description: string) { @@ -261,6 +267,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.videoHTMLDescription = this.markdownService.markdownToHTML(this.video.description) } + private setVideoLikesBarTooltipText () { + this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` + } + private handleError (err: any) { const errorMessage: string = typeof err === 'string' ? err : err.message let message = '' @@ -346,6 +356,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } this.setVideoDescriptionHTML() + this.setVideoLikesBarTooltipText() this.setOpenGraphTags() this.checkUserRating()