aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-29 17:15:05 +0200
committerChocobozzz <me@florianbigard.com>2021-06-29 17:15:05 +0200
commitb0c43e36dbdc2c964f6828a78b146faebfb75b21 (patch)
tree6caaa00081b82ae5276fa6ab64f22a6fbdf5b1f0 /client/src/app/+videos/+video-watch/video-watch.component.ts
parent6ea59f415461c27eea840ed204986eaefb538afc (diff)
downloadPeerTube-b0c43e36dbdc2c964f6828a78b146faebfb75b21.tar.gz
PeerTube-b0c43e36dbdc2c964f6828a78b146faebfb75b21.tar.zst
PeerTube-b0c43e36dbdc2c964f6828a78b146faebfb75b21.zip
Create a dedicated component for video description
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.ts50
1 files changed, 0 insertions, 50 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 e2fbf7524..e6b353220 100644
--- a/client/src/app/+videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/+videos/+video-watch/video-watch.component.ts
@@ -8,7 +8,6 @@ import {
8 AuthService, 8 AuthService,
9 AuthUser, 9 AuthUser,
10 ConfirmService, 10 ConfirmService,
11 MarkdownService,
12 MetaService, 11 MetaService,
13 Notifier, 12 Notifier,
14 PeerTubeSocket, 13 PeerTubeSocket,
@@ -139,7 +138,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
139 private serverService: ServerService, 138 private serverService: ServerService,
140 private restExtractor: RestExtractor, 139 private restExtractor: RestExtractor,
141 private notifier: Notifier, 140 private notifier: Notifier,
142 private markdownService: MarkdownService,
143 private zone: NgZone, 141 private zone: NgZone,
144 private redirectService: RedirectService, 142 private redirectService: RedirectService,
145 private videoCaptionService: VideoCaptionService, 143 private videoCaptionService: VideoCaptionService,
@@ -228,20 +226,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
228 this.hotkeysService.remove(this.hotkeys) 226 this.hotkeysService.remove(this.hotkeys)
229 } 227 }
230 228
231 showMoreDescription () {
232 if (this.completeVideoDescription === undefined) {
233 return this.loadCompleteDescription()
234 }
235
236 this.updateVideoDescription(this.completeVideoDescription)
237 this.completeDescriptionShown = true
238 }
239
240 showLessDescription () {
241 this.updateVideoDescription(this.shortVideoDescription)
242 this.completeDescriptionShown = false
243 }
244
245 showDownloadModal () { 229 showDownloadModal () {
246 this.videoDownloadModal.show(this.video, this.videoCaptions) 230 this.videoDownloadModal.show(this.video, this.videoCaptions)
247 } 231 }
@@ -250,28 +234,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
250 return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled && !this.video.isLive 234 return this.video && this.video instanceof VideoDetails && this.video.downloadEnabled && !this.video.isLive
251 } 235 }
252 236
253 loadCompleteDescription () {
254 this.descriptionLoading = true
255
256 this.videoService.loadCompleteDescription(this.video.descriptionPath)
257 .subscribe(
258 description => {
259 this.completeDescriptionShown = true
260 this.descriptionLoading = false
261
262 this.shortVideoDescription = this.video.description
263 this.completeVideoDescription = description
264
265 this.updateVideoDescription(this.completeVideoDescription)
266 },
267
268 error => {
269 this.descriptionLoading = false
270 this.notifier.error(error.message)
271 }
272 )
273 }
274
275 showSupportModal () { 237 showSupportModal () {
276 this.supportModal.show() 238 this.supportModal.show()
277 } 239 }
@@ -492,17 +454,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
492 }) 454 })
493 } 455 }
494 456
495 private updateVideoDescription (description: string) {
496 this.video.description = description
497 this.setVideoDescriptionHTML()
498 .catch(err => console.error(err))
499 }
500
501 private async setVideoDescriptionHTML () {
502 const html = await this.markdownService.textMarkdownToHTML(this.video.description)
503 this.videoHTMLDescription = this.markdownService.processVideoTimestamps(html)
504 }
505
506 private setVideoLikesBarTooltipText () { 457 private setVideoLikesBarTooltipText () {
507 this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` 458 this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes`
508 } 459 }
@@ -552,7 +503,6 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
552 this.buildPlayer(urlOptions) 503 this.buildPlayer(urlOptions)
553 .catch(err => console.error('Cannot build the player', err)) 504 .catch(err => console.error('Cannot build the player', err))
554 505
555 this.setVideoDescriptionHTML()
556 this.setVideoLikesBarTooltipText() 506 this.setVideoLikesBarTooltipText()
557 507
558 this.setOpenGraphTags() 508 this.setOpenGraphTags()