aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-10 10:02:18 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-10 10:18:16 +0200
commit35bf0c83c80f59ca79f4b84fac8700f17adeb22d (patch)
treea9b2106096d6ba04d7219051b17fd32cfbe6a885 /client/src/app/videos
parent769d332177a5b02d5c2ffc134687d3b4ed65bae9 (diff)
downloadPeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.tar.gz
PeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.tar.zst
PeerTube-35bf0c83c80f59ca79f4b84fac8700f17adeb22d.zip
Video blacklist refractoring
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts19
-rw-r--r--client/src/app/videos/shared/video.service.ts6
2 files changed, 10 insertions, 15 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 874dd5997..bd98e877c 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -14,7 +14,7 @@ import { VideoMagnetComponent } from './video-magnet.component'
14import { VideoShareComponent } from './video-share.component' 14import { VideoShareComponent } from './video-share.component'
15import { VideoReportComponent } from './video-report.component' 15import { VideoReportComponent } from './video-report.component'
16import { Video, VideoService } from '../shared' 16import { Video, VideoService } from '../shared'
17import { WebTorrentService } from './webtorrent.service' 17import { VideoBlacklistService } from '../../shared'
18import { UserVideoRateType, VideoRateType } from '../../../../../shared' 18import { UserVideoRateType, VideoRateType } from '../../../../../shared'
19 19
20@Component({ 20@Component({
@@ -45,6 +45,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
45 private route: ActivatedRoute, 45 private route: ActivatedRoute,
46 private router: Router, 46 private router: Router,
47 private videoService: VideoService, 47 private videoService: VideoService,
48 private videoBlacklistService: VideoBlacklistService,
48 private confirmService: ConfirmService, 49 private confirmService: ConfirmService,
49 private metaService: MetaService, 50 private metaService: MetaService,
50 private authService: AuthService, 51 private authService: AuthService,
@@ -137,15 +138,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
137 res => { 138 res => {
138 if (res === false) return 139 if (res === false) return
139 140
140 this.videoService.blacklistVideo(this.video.id) 141 this.videoBlacklistService.blacklistVideo(this.video.id)
141 .subscribe( 142 .subscribe(
142 status => { 143 status => {
143 this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`) 144 this.notificationsService.success('Success', `Video ${this.video.name} had been blacklisted.`)
144 this.router.navigate(['/videos/list']) 145 this.router.navigate(['/videos/list'])
145 }, 146 },
146 147
147 error => this.notificationsService.error('Error', error.text) 148 error => this.notificationsService.error('Error', error.text)
148 ) 149 )
149 } 150 }
150 ) 151 )
151 } 152 }
diff --git a/client/src/app/videos/shared/video.service.ts b/client/src/app/videos/shared/video.service.ts
index 037c20416..fe7f9108d 100644
--- a/client/src/app/videos/shared/video.service.ts
+++ b/client/src/app/videos/shared/video.service.ts
@@ -122,12 +122,6 @@ export class VideoService {
122 .catch(res => this.restExtractor.handleError(res)) 122 .catch(res => this.restExtractor.handleError(res))
123 } 123 }
124 124
125 blacklistVideo (id: number) {
126 return this.authHttp.post(VideoService.BASE_VIDEO_URL + id + '/blacklist', {})
127 .map(this.restExtractor.extractDataBool)
128 .catch(res => this.restExtractor.handleError(res))
129 }
130
131 private videoPaginationToRestPagination (videoPagination: VideoPagination) { 125 private videoPaginationToRestPagination (videoPagination: VideoPagination) {
132 const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage 126 const start: number = (videoPagination.currentPage - 1) * videoPagination.itemsPerPage
133 const count: number = videoPagination.itemsPerPage 127 const count: number = videoPagination.itemsPerPage