aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html2
-rw-r--r--client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts39
-rw-r--r--client/src/app/shared/shared-main/video/video.model.ts3
3 files changed, 28 insertions, 16 deletions
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html
index fa4dbb3ca..d847daff7 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.html
@@ -1,7 +1,7 @@
1<div class="video-info-description"> 1<div class="video-info-description">
2 <div 2 <div
3 class="video-info-description-html" 3 class="video-info-description-html"
4 [innerHTML]="videoHTMLDescription" 4 [innerHTML]="getHTMLDescription()"
5 (timestampClicked)="onTimestampClicked($event)" 5 (timestampClicked)="onTimestampClicked($event)"
6 myTimestampRouteTransformer 6 myTimestampRouteTransformer
7 ></div> 7 ></div>
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
index 72b09a274..d01080611 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts
@@ -15,8 +15,10 @@ export class VideoDescriptionComponent implements OnChanges {
15 15
16 descriptionLoading = false 16 descriptionLoading = false
17 completeDescriptionShown = false 17 completeDescriptionShown = false
18 completeVideoDescription: string 18
19 shortVideoDescription: string 19 completeVideoDescriptionLoaded = false
20
21 videoHTMLTruncatedDescription = ''
20 videoHTMLDescription = '' 22 videoHTMLDescription = ''
21 23
22 constructor ( 24 constructor (
@@ -28,22 +30,19 @@ export class VideoDescriptionComponent implements OnChanges {
28 ngOnChanges () { 30 ngOnChanges () {
29 this.descriptionLoading = false 31 this.descriptionLoading = false
30 this.completeDescriptionShown = false 32 this.completeDescriptionShown = false
31 this.completeVideoDescription = undefined
32 33
33 this.setVideoDescriptionHTML() 34 this.setVideoDescriptionHTML()
34 } 35 }
35 36
36 showMoreDescription () { 37 showMoreDescription () {
37 if (this.completeVideoDescription === undefined) { 38 if (!this.completeVideoDescriptionLoaded) {
38 return this.loadCompleteDescription() 39 return this.loadCompleteDescription()
39 } 40 }
40 41
41 this.updateVideoDescription(this.completeVideoDescription)
42 this.completeDescriptionShown = true 42 this.completeDescriptionShown = true
43 } 43 }
44 44
45 showLessDescription () { 45 showLessDescription () {
46 this.updateVideoDescription(this.shortVideoDescription)
47 this.completeDescriptionShown = false 46 this.completeDescriptionShown = false
48 } 47 }
49 48
@@ -56,10 +55,10 @@ export class VideoDescriptionComponent implements OnChanges {
56 this.completeDescriptionShown = true 55 this.completeDescriptionShown = true
57 this.descriptionLoading = false 56 this.descriptionLoading = false
58 57
59 this.shortVideoDescription = this.video.description 58 this.video.description = description
60 this.completeVideoDescription = description
61 59
62 this.updateVideoDescription(this.completeVideoDescription) 60 this.setVideoDescriptionHTML()
61 .catch(err => logger.error(err))
63 }, 62 },
64 63
65 error: err => { 64 error: err => {
@@ -73,15 +72,25 @@ export class VideoDescriptionComponent implements OnChanges {
73 this.timestampClicked.emit(timestamp) 72 this.timestampClicked.emit(timestamp)
74 } 73 }
75 74
76 private updateVideoDescription (description: string) { 75 getHTMLDescription () {
77 this.video.description = description 76 if (this.completeDescriptionShown) {
78 this.setVideoDescriptionHTML() 77 return this.videoHTMLDescription
79 .catch(err => logger.error(err)) 78 }
79
80 return this.videoHTMLTruncatedDescription
80 } 81 }
81 82
82 private async setVideoDescriptionHTML () { 83 private async setVideoDescriptionHTML () {
83 const html = await this.markdownService.textMarkdownToHTML({ markdown: this.video.description }) 84 {
85 const html = await this.markdownService.textMarkdownToHTML({ markdown: this.video.description })
84 86
85 this.videoHTMLDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html) 87 this.videoHTMLDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
88 }
89
90 {
91 const html = await this.markdownService.textMarkdownToHTML({ markdown: this.video.truncatedDescription })
92
93 this.videoHTMLTruncatedDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
94 }
86 } 95 }
87} 96}
diff --git a/client/src/app/shared/shared-main/video/video.model.ts b/client/src/app/shared/shared-main/video/video.model.ts
index c9c6b979c..6fdffb394 100644
--- a/client/src/app/shared/shared-main/video/video.model.ts
+++ b/client/src/app/shared/shared-main/video/video.model.ts
@@ -34,6 +34,7 @@ export class Video implements VideoServerModel {
34 language: VideoConstant<string> 34 language: VideoConstant<string>
35 privacy: VideoConstant<VideoPrivacy> 35 privacy: VideoConstant<VideoPrivacy>
36 36
37 truncatedDescription: string
37 description: string 38 description: string
38 39
39 duration: number 40 duration: number
@@ -134,6 +135,8 @@ export class Video implements VideoServerModel {
134 this.privacy = hash.privacy 135 this.privacy = hash.privacy
135 this.waitTranscoding = hash.waitTranscoding 136 this.waitTranscoding = hash.waitTranscoding
136 this.state = hash.state 137 this.state = hash.state
138
139 this.truncatedDescription = hash.truncatedDescription
137 this.description = hash.description 140 this.description = hash.description
138 141
139 this.isLive = hash.isLive 142 this.isLive = hash.isLive