aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-05-31 11:48:28 +0200
committerChocobozzz <me@florianbigard.com>2019-05-31 11:48:28 +0200
commit4c72c1cd411b4ff7ed054b584f184117bae91d5b (patch)
tree680a9de2f2a4cda92ee13f2028badd6e5696377a
parent34c7f429e411fb911dfa56a816b638fd665717a4 (diff)
downloadPeerTube-4c72c1cd411b4ff7ed054b584f184117bae91d5b.tar.gz
PeerTube-4c72c1cd411b4ff7ed054b584f184117bae91d5b.tar.zst
PeerTube-4c72c1cd411b4ff7ed054b584f184117bae91d5b.zip
Move concurrently in dev package
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts69
-rw-r--r--package.json2
-rw-r--r--yarn.lock2
3 files changed, 34 insertions, 39 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 55109dc32..2d13f1b58 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -6,7 +6,7 @@ import { 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 { Notifier, ServerService } from '@app/core' 8import { Notifier, ServerService } from '@app/core'
9import { forkJoin, Subscription } from 'rxjs' 9import { forkJoin, Observable, Subscription } from 'rxjs'
10import { Hotkey, HotkeysService } from 'angular2-hotkeys' 10import { Hotkey, HotkeysService } from 'angular2-hotkeys'
11import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared' 11import { UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '../../../../../shared'
12import { AuthService, ConfirmService } from '../../core' 12import { AuthService, ConfirmService } from '../../core'
@@ -135,22 +135,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
135 135
136 setLike () { 136 setLike () {
137 if (this.isUserLoggedIn() === false) return 137 if (this.isUserLoggedIn() === false) return
138 if (this.userRating === 'like') { 138
139 // Already liked this video 139 // Already liked this video
140 this.setRating('none') 140 if (this.userRating === 'like') this.setRating('none')
141 } else { 141 else this.setRating('like')
142 this.setRating('like')
143 }
144 } 142 }
145 143
146 setDislike () { 144 setDislike () {
147 if (this.isUserLoggedIn() === false) return 145 if (this.isUserLoggedIn() === false) return
148 if (this.userRating === 'dislike') { 146
149 // Already disliked this video 147 // Already disliked this video
150 this.setRating('none') 148 if (this.userRating === 'dislike') this.setRating('none')
151 } else { 149 else this.setRating('dislike')
152 this.setRating('dislike')
153 }
154 } 150 }
155 151
156 showMoreDescription () { 152 showMoreDescription () {
@@ -249,12 +245,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
249 ) 245 )
250 .subscribe(([ video, captionsResult ]) => { 246 .subscribe(([ video, captionsResult ]) => {
251 const queryParams = this.route.snapshot.queryParams 247 const queryParams = this.route.snapshot.queryParams
252 const startTime = queryParams.start
253 const stopTime = queryParams.stop
254 const subtitle = queryParams.subtitle
255 const playerMode = queryParams.mode
256 248
257 this.onVideoFetched(video, captionsResult.data, { startTime, stopTime, subtitle, playerMode }) 249 const urlOptions = {
250 startTime: queryParams.start,
251 stopTime: queryParams.stop,
252 subtitle: queryParams.subtitle,
253 playerMode: queryParams.mode
254 }
255
256 this.onVideoFetched(video, captionsResult.data, urlOptions)
258 .catch(err => this.handleError(err)) 257 .catch(err => this.handleError(err))
259 }) 258 })
260 } 259 }
@@ -279,6 +278,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
279 private updateVideoDescription (description: string) { 278 private updateVideoDescription (description: string) {
280 this.video.description = description 279 this.video.description = description
281 this.setVideoDescriptionHTML() 280 this.setVideoDescriptionHTML()
281 .catch(err => console.error(err))
282 } 282 }
283 283
284 private async setVideoDescriptionHTML () { 284 private async setVideoDescriptionHTML () {
@@ -385,7 +385,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
385 captions: videoCaptions.length !== 0, 385 captions: videoCaptions.length !== 0,
386 peertubeLink: false, 386 peertubeLink: false,
387 387
388 videoViewUrl: this.video.privacy.id !== VideoPrivacy.PRIVATE ? this.videoService.getVideoViewUrl(this.video.uuid) : null, 388 videoViewUrl: this.video.privacy.id !== VideoPrivacy.PRIVATE
389 ? this.videoService.getVideoViewUrl(this.video.uuid)
390 : null,
389 embedUrl: this.video.embedUrl, 391 embedUrl: this.video.embedUrl,
390 392
391 language: this.localeId, 393 language: this.localeId,
@@ -466,20 +468,13 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
466 } 468 }
467 469
468 private setRating (nextRating: UserVideoRateType) { 470 private setRating (nextRating: UserVideoRateType) {
469 let method 471 const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable<any> } = {
470 switch (nextRating) { 472 like: this.videoService.setVideoLike,
471 case 'like': 473 dislike: this.videoService.setVideoDislike,
472 method = this.videoService.setVideoLike 474 none: this.videoService.unsetVideoLike
473 break
474 case 'dislike':
475 method = this.videoService.setVideoDislike
476 break
477 case 'none':
478 method = this.videoService.unsetVideoLike
479 break
480 } 475 }
481 476
482 method.call(this.videoService, this.video.id) 477 ratingMethods[nextRating].call(this.videoService, this.video.id)
483 .subscribe( 478 .subscribe(
484 () => { 479 () => {
485 // Update the video like attribute 480 // Update the video like attribute
@@ -556,18 +551,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
556 551
557 private initHotkeys () { 552 private initHotkeys () {
558 this.hotkeys = [ 553 this.hotkeys = [
559 new Hotkey('shift+l', (event: KeyboardEvent): boolean => { 554 new Hotkey('shift+l', () => {
560 this.setLike() 555 this.setLike()
561 return false 556 return false
562 }, undefined, this.i18n('Like the video')), 557 }, undefined, this.i18n('Like the video')),
563 new Hotkey('shift+d', (event: KeyboardEvent): boolean => { 558
559 new Hotkey('shift+d', () => {
564 this.setDislike() 560 this.setDislike()
565 return false 561 return false
566 }, undefined, this.i18n('Dislike the video')), 562 }, undefined, this.i18n('Dislike the video')),
567 new Hotkey('shift+s', (event: KeyboardEvent): boolean => { 563
568 this.subscribeButton.subscribed ? 564 new Hotkey('shift+s', () => {
569 this.subscribeButton.unsubscribe() : 565 this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
570 this.subscribeButton.subscribe()
571 return false 566 return false
572 }, undefined, this.i18n('Subscribe to the account')) 567 }, undefined, this.i18n('Subscribe to the account'))
573 ] 568 ]
diff --git a/package.json b/package.json
index bdc389572..2118c9dcf 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,6 @@
103 "bytes": "^3.0.0", 103 "bytes": "^3.0.0",
104 "cli-table": "^0.3.1", 104 "cli-table": "^0.3.1",
105 "commander": "^2.13.0", 105 "commander": "^2.13.0",
106 "concurrently": "^4.0.1",
107 "config": "^3.0.0", 106 "config": "^3.0.0",
108 "cookie-parser": "^1.4.3", 107 "cookie-parser": "^1.4.3",
109 "cors": "^2.8.1", 108 "cors": "^2.8.1",
@@ -198,6 +197,7 @@
198 "chai": "^4.1.1", 197 "chai": "^4.1.1",
199 "chai-json-schema": "^1.5.0", 198 "chai-json-schema": "^1.5.0",
200 "chai-xml": "^0.3.2", 199 "chai-xml": "^0.3.2",
200 "concurrently": "^4.1.0",
201 "husky": "^1.0.0-rc.4", 201 "husky": "^1.0.0-rc.4",
202 "libxmljs": "0.19.5", 202 "libxmljs": "0.19.5",
203 "lint-staged": "^8.0.4", 203 "lint-staged": "^8.0.4",
diff --git a/yarn.lock b/yarn.lock
index 6c287a193..4d03b2db7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1570,7 +1570,7 @@ concat-stream@^1.4.6, concat-stream@^1.5.2:
1570 readable-stream "^2.2.2" 1570 readable-stream "^2.2.2"
1571 typedarray "^0.0.6" 1571 typedarray "^0.0.6"
1572 1572
1573concurrently@^4.0.1: 1573concurrently@^4.1.0:
1574 version "4.1.0" 1574 version "4.1.0"
1575 resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-4.1.0.tgz#17fdf067da71210685d9ea554423ef239da30d33" 1575 resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-4.1.0.tgz#17fdf067da71210685d9ea554423ef239da30d33"
1576 integrity sha512-pwzXCE7qtOB346LyO9eFWpkFJVO3JQZ/qU/feGeaAHiX1M3Rw3zgXKc5cZ8vSH5DGygkjzLFDzA/pwoQDkRNGg== 1576 integrity sha512-pwzXCE7qtOB346LyO9eFWpkFJVO3JQZ/qU/feGeaAHiX1M3Rw3zgXKc5cZ8vSH5DGygkjzLFDzA/pwoQDkRNGg==