aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-15 11:55:51 +0200
committerChocobozzz <me@florianbigard.com>2018-05-16 09:42:54 +0200
commitdb400f447a9f7aae1c56fa25396e93069744483f (patch)
treef45af832a5d3f4eebafd2f885b7413d9f84fa374 /client/src/app/videos
parent54c3a22faa04bf13eea37f39be9149fc5eb95737 (diff)
downloadPeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.gz
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.tar.zst
PeerTube-db400f447a9f7aae1c56fa25396e93069744483f.zip
Upgrade to rxjs 6
Diffstat (limited to 'client/src/app/videos')
-rw-r--r--client/src/app/videos/+video-edit/shared/video-edit.component.ts1
-rw-r--r--client/src/app/videos/+video-edit/shared/video-image.component.ts2
-rw-r--r--client/src/app/videos/+video-edit/video-add.component.ts3
-rw-r--r--client/src/app/videos/+video-edit/video-update.component.ts61
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment-add.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts44
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts2
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts3
-rw-r--r--client/src/app/videos/video-list/video-search.component.ts2
9 files changed, 62 insertions, 58 deletions
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 77e984855..eab0a898e 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
@@ -3,7 +3,6 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { VIDEO_IMAGE, VIDEO_SUPPORT } from '@app/shared' 4import { VIDEO_IMAGE, VIDEO_SUPPORT } from '@app/shared'
5import { NotificationsService } from 'angular2-notifications' 5import { NotificationsService } from 'angular2-notifications'
6import 'rxjs/add/observable/forkJoin'
7import { ServerService } from '../../../core/server' 6import { ServerService } from '../../../core/server'
8import { VIDEO_CHANNEL } from '../../../shared/forms/form-validators' 7import { VIDEO_CHANNEL } from '../../../shared/forms/form-validators'
9import { ValidatorMessage } from '../../../shared/forms/form-validators/validator-message' 8import { ValidatorMessage } from '../../../shared/forms/form-validators/validator-message'
diff --git a/client/src/app/videos/+video-edit/shared/video-image.component.ts b/client/src/app/videos/+video-edit/shared/video-image.component.ts
index 3f5705a92..df6565857 100644
--- a/client/src/app/videos/+video-edit/shared/video-image.component.ts
+++ b/client/src/app/videos/+video-edit/shared/video-image.component.ts
@@ -2,7 +2,6 @@ import { Component, forwardRef, Input } from '@angular/core'
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser' 3import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
4import { ServerService } from '@app/core' 4import { ServerService } from '@app/core'
5import 'rxjs/add/observable/forkJoin'
6 5
7@Component({ 6@Component({
8 selector: 'my-video-image', 7 selector: 'my-video-image',
@@ -16,7 +15,6 @@ import 'rxjs/add/observable/forkJoin'
16 } 15 }
17 ] 16 ]
18}) 17})
19
20export class VideoImageComponent implements ControlValueAccessor { 18export class VideoImageComponent implements ControlValueAccessor {
21 @Input() inputLabel: string 19 @Input() inputLabel: string
22 @Input() inputName: string 20 @Input() inputName: string
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts
index fa967018d..41d14573c 100644
--- a/client/src/app/videos/+video-edit/video-add.component.ts
+++ b/client/src/app/videos/+video-edit/video-add.component.ts
@@ -7,7 +7,7 @@ import { CanComponentDeactivate } from '@app/shared/guards/can-deactivate-guard.
7import { LoadingBarService } from '@ngx-loading-bar/core' 7import { LoadingBarService } from '@ngx-loading-bar/core'
8import { NotificationsService } from 'angular2-notifications' 8import { NotificationsService } from 'angular2-notifications'
9import { BytesPipe } from 'ngx-pipes' 9import { BytesPipe } from 'ngx-pipes'
10import { Subscription } from 'rxjs/Subscription' 10import { Subscription } from 'rxjs'
11import { VideoPrivacy } from '../../../../../shared/models/videos' 11import { VideoPrivacy } from '../../../../../shared/models/videos'
12import { AuthService, ServerService } from '../../core' 12import { AuthService, ServerService } from '../../core'
13import { FormReactive } from '../../shared' 13import { FormReactive } from '../../shared'
@@ -24,7 +24,6 @@ import { VideoService } from '../../shared/video/video.service'
24 './video-add.component.scss' 24 './video-add.component.scss'
25 ] 25 ]
26}) 26})
27
28export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate { 27export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy, CanComponentDeactivate {
29 @ViewChild('videofileInput') videofileInput 28 @ViewChild('videofileInput') videofileInput
30 29
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 73e2764c6..b1d80bcaa 100644
--- a/client/src/app/videos/+video-edit/video-update.component.ts
+++ b/client/src/app/videos/+video-edit/video-update.component.ts
@@ -1,9 +1,9 @@
1import { map, switchMap } from 'rxjs/operators'
1import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 3import { FormBuilder, FormGroup } from '@angular/forms'
3import { ActivatedRoute, Router } from '@angular/router' 4import { ActivatedRoute, Router } from '@angular/router'
4import { LoadingBarService } from '@ngx-loading-bar/core' 5import { LoadingBarService } from '@ngx-loading-bar/core'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
6import 'rxjs/add/observable/forkJoin'
7import { VideoPrivacy } from '../../../../../shared/models/videos' 7import { VideoPrivacy } from '../../../../../shared/models/videos'
8import { ServerService } from '../../core' 8import { ServerService } from '../../core'
9import { AuthService } from '../../core/auth' 9import { AuthService } from '../../core/auth'
@@ -18,7 +18,6 @@ import { populateAsyncUserVideoChannels } from '@app/shared/misc/utils'
18 styleUrls: [ './shared/video-edit.component.scss' ], 18 styleUrls: [ './shared/video-edit.component.scss' ],
19 templateUrl: './video-update.component.html' 19 templateUrl: './video-update.component.html'
20}) 20})
21
22export class VideoUpdateComponent extends FormReactive implements OnInit { 21export class VideoUpdateComponent extends FormReactive implements OnInit {
23 video: VideoEdit 22 video: VideoEdit
24 23
@@ -53,38 +52,40 @@ export class VideoUpdateComponent extends FormReactive implements OnInit {
53 this.serverService.videoPrivaciesLoaded 52 this.serverService.videoPrivaciesLoaded
54 .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies()) 53 .subscribe(() => this.videoPrivacies = this.serverService.getVideoPrivacies())
55 54
56 const uuid: string = this.route.snapshot.params['uuid'] 55 const uuid: string = this.route.snapshot.params[ 'uuid' ]
57 this.videoService.getVideo(uuid) 56 this.videoService.getVideo(uuid)
58 .switchMap(video => { 57 .pipe(
59 return this.videoService 58 switchMap(video => {
60 .loadCompleteDescription(video.descriptionPath) 59 return this.videoService
61 .map(description => Object.assign(video, { description })) 60 .loadCompleteDescription(video.descriptionPath)
62 }) 61 .pipe(map(description => Object.assign(video, { description })))
63 .subscribe( 62 })
64 video => { 63 )
65 this.video = new VideoEdit(video) 64 .subscribe(
66 65 video => {
67 populateAsyncUserVideoChannels(this.authService, this.userVideoChannels) 66 this.video = new VideoEdit(video)
68 .catch(err => console.error(err)) 67
69 68 populateAsyncUserVideoChannels(this.authService, this.userVideoChannels)
70 // We cannot set private a video that was not private 69 .catch(err => console.error(err))
71 if (video.privacy.id !== VideoPrivacy.PRIVATE) { 70
72 const newVideoPrivacies = [] 71 // We cannot set private a video that was not private
73 for (const p of this.videoPrivacies) { 72 if (video.privacy.id !== VideoPrivacy.PRIVATE) {
74 if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p) 73 const newVideoPrivacies = []
74 for (const p of this.videoPrivacies) {
75 if (p.id !== VideoPrivacy.PRIVATE) newVideoPrivacies.push(p)
76 }
77
78 this.videoPrivacies = newVideoPrivacies
75 } 79 }
76 80
77 this.videoPrivacies = newVideoPrivacies 81 this.hydrateFormFromVideo()
78 } 82 },
79 83
80 this.hydrateFormFromVideo() 84 err => {
81 }, 85 console.error(err)
82 86 this.notificationsService.error('Error', err.message)
83 err => { 87 }
84 console.error(err) 88 )
85 this.notificationsService.error('Error', err.message)
86 }
87 )
88 } 89 }
89 90
90 checkForm () { 91 checkForm () {
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 d1ca1968b..b1f446475 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,7 +1,7 @@
1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { Observable } from 'rxjs/Observable' 4import { Observable } from 'rxjs'
5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model' 5import { VideoCommentCreate } from '../../../../../../shared/models/videos/video-comment.model'
6import { FormReactive } from '../../../shared' 6import { FormReactive } from '../../../shared'
7import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment' 7import { VIDEO_COMMENT_TEXT } from '../../../shared/forms/form-validators/video-comment'
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.service.ts b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
index 0bf7696fe..5b9a991a0 100644
--- a/client/src/app/videos/+video-watch/comment/video-comment.service.ts
+++ b/client/src/app/videos/+video-watch/comment/video-comment.service.ts
@@ -1,10 +1,8 @@
1import { catchError, map } from 'rxjs/operators'
1import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
2import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
3import { lineFeedToHtml } from '@app/shared/misc/utils' 4import { lineFeedToHtml } from '@app/shared/misc/utils'
4import { MarkdownService } from '@app/videos/shared' 5import { Observable } from 'rxjs'
5import 'rxjs/add/operator/catch'
6import 'rxjs/add/operator/map'
7import { Observable } from 'rxjs/Observable'
8import { ResultList } from '../../../../../../shared/models' 6import { ResultList } from '../../../../../../shared/models'
9import { 7import {
10 VideoComment as VideoCommentServerModel, 8 VideoComment as VideoCommentServerModel,
@@ -32,8 +30,10 @@ export class VideoCommentService {
32 const normalizedComment = lineFeedToHtml(comment, 'text') 30 const normalizedComment = lineFeedToHtml(comment, 'text')
33 31
34 return this.authHttp.post(url, normalizedComment) 32 return this.authHttp.post(url, normalizedComment)
35 .map(data => this.extractVideoComment(data['comment'])) 33 .pipe(
36 .catch(this.restExtractor.handleError) 34 map(data => this.extractVideoComment(data['comment'])),
35 catchError(this.restExtractor.handleError)
36 )
37 } 37 }
38 38
39 addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) { 39 addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) {
@@ -41,8 +41,10 @@ export class VideoCommentService {
41 const normalizedComment = lineFeedToHtml(comment, 'text') 41 const normalizedComment = lineFeedToHtml(comment, 'text')
42 42
43 return this.authHttp.post(url, normalizedComment) 43 return this.authHttp.post(url, normalizedComment)
44 .map(data => this.extractVideoComment(data['comment'])) 44 .pipe(
45 .catch(this.restExtractor.handleError) 45 map(data => this.extractVideoComment(data[ 'comment' ])),
46 catchError(this.restExtractor.handleError)
47 )
46 } 48 }
47 49
48 getVideoCommentThreads ( 50 getVideoCommentThreads (
@@ -57,27 +59,33 @@ export class VideoCommentService {
57 59
58 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' 60 const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
59 return this.authHttp 61 return this.authHttp
60 .get(url, { params }) 62 .get(url, { params })
61 .map(this.extractVideoComments) 63 .pipe(
62 .catch((res) => this.restExtractor.handleError(res)) 64 map(this.extractVideoComments),
65 catchError((res) => this.restExtractor.handleError(res))
66 )
63 } 67 }
64 68
65 getVideoThreadComments (videoId: number | string, threadId: number): Observable<VideoCommentThreadTree> { 69 getVideoThreadComments (videoId: number | string, threadId: number): Observable<VideoCommentThreadTree> {
66 const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` 70 const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}`
67 71
68 return this.authHttp 72 return this.authHttp
69 .get(url) 73 .get(url)
70 .map(tree => this.extractVideoCommentTree(tree as VideoCommentThreadTree)) 74 .pipe(
71 .catch((res) => this.restExtractor.handleError(res)) 75 map(tree => this.extractVideoCommentTree(tree as VideoCommentThreadTree)),
76 catchError((res) => this.restExtractor.handleError(res))
77 )
72 } 78 }
73 79
74 deleteVideoComment (videoId: number | string, commentId: number) { 80 deleteVideoComment (videoId: number | string, commentId: number) {
75 const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comments/${commentId}` 81 const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comments/${commentId}`
76 82
77 return this.authHttp 83 return this.authHttp
78 .delete(url) 84 .delete(url)
79 .map(this.restExtractor.extractDataBool) 85 .pipe(
80 .catch((res) => this.restExtractor.handleError(res)) 86 map(this.restExtractor.extractDataBool),
87 catchError((res) => this.restExtractor.handleError(res))
88 )
81 } 89 }
82 90
83 private extractVideoComment (videoComment: VideoCommentServerModel) { 91 private extractVideoComment (videoComment: VideoCommentServerModel) {
@@ -87,7 +95,7 @@ export class VideoCommentService {
87 private extractVideoComments (result: ResultList<VideoCommentServerModel>) { 95 private extractVideoComments (result: ResultList<VideoCommentServerModel>) {
88 const videoCommentsJson = result.data 96 const videoCommentsJson = result.data
89 const totalComments = result.total 97 const totalComments = result.total
90 const comments = [] 98 const comments: VideoComment[] = []
91 99
92 for (const videoCommentJson of videoCommentsJson) { 100 for (const videoCommentJson of videoCommentsJson) {
93 comments.push(new VideoComment(videoCommentJson)) 101 comments.push(new VideoComment(videoCommentJson))
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 a77a6e9f3..34f4a0701 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
@@ -2,7 +2,7 @@ import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@
2import { ActivatedRoute } from '@angular/router' 2import { ActivatedRoute } from '@angular/router'
3import { ConfirmService } from '@app/core' 3import { ConfirmService } from '@app/core'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
5import { Subscription } from 'rxjs/Subscription' 5import { Subscription } from 'rxjs'
6import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model' 6import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/video-comment.model'
7import { AuthService } from '../../../core/auth' 7import { AuthService } from '../../../core/auth'
8import { ComponentPagination } from '../../../shared/rest/component-pagination.model' 8import { ComponentPagination } from '../../../shared/rest/component-pagination.model'
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 615b969e5..127ae919d 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 { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
5import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component' 5import { VideoSupportComponent } from '@app/videos/+video-watch/modal/video-support.component'
6import { MetaService } from '@ngx-meta/core' 6import { MetaService } from '@ngx-meta/core'
7import { NotificationsService } from 'angular2-notifications' 7import { NotificationsService } from 'angular2-notifications'
8import { Subscription } from 'rxjs/Subscription' 8import { Subscription } from 'rxjs'
9import * as videojs from 'video.js' 9import * as videojs from 'video.js'
10import 'videojs-hotkeys' 10import 'videojs-hotkeys'
11import * as WebTorrent from 'webtorrent' 11import * as WebTorrent from 'webtorrent'
@@ -13,7 +13,6 @@ import { UserVideoRateType, VideoRateType } from '../../../../../shared'
13import '../../../assets/player/peertube-videojs-plugin' 13import '../../../assets/player/peertube-videojs-plugin'
14import { AuthService, ConfirmService } from '../../core' 14import { AuthService, ConfirmService } from '../../core'
15import { VideoBlacklistService } from '../../shared' 15import { VideoBlacklistService } from '../../shared'
16import { Account } from '../../shared/account/account.model'
17import { VideoDetails } from '../../shared/video/video-details.model' 16import { VideoDetails } from '../../shared/video/video-details.model'
18import { Video } from '../../shared/video/video.model' 17import { Video } from '../../shared/video/video.model'
19import { VideoService } from '../../shared/video/video.service' 18import { VideoService } from '../../shared/video/video.service'
diff --git a/client/src/app/videos/video-list/video-search.component.ts b/client/src/app/videos/video-list/video-search.component.ts
index 774d81ed6..aab896d84 100644
--- a/client/src/app/videos/video-list/video-search.component.ts
+++ b/client/src/app/videos/video-list/video-search.component.ts
@@ -4,7 +4,7 @@ import { Location } from '@angular/common'
4import { RedirectService } from '@app/core' 4import { RedirectService } from '@app/core'
5import { immutableAssign } from '@app/shared/misc/utils' 5import { immutableAssign } from '@app/shared/misc/utils'
6import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
7import { Subscription } from 'rxjs/Subscription' 7import { Subscription } from 'rxjs'
8import { AuthService } from '../../core/auth' 8import { AuthService } from '../../core/auth'
9import { AbstractVideoList } from '../../shared/video/abstract-video-list' 9import { AbstractVideoList } from '../../shared/video/abstract-video-list'
10import { VideoService } from '../../shared/video/video.service' 10import { VideoService } from '../../shared/video/video.service'