aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-02 11:14:59 +0200
committerChocobozzz <me@florianbigard.com>2018-10-02 11:19:12 +0200
commit53877968a6bff713be6f0e15042e13a5da5e5e1a (patch)
tree5c88ce7aa0b578e667c35a13c874734838779575 /client/src
parentd95fdb5af958f84af876356e4293ae2d1be05161 (diff)
downloadPeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.tar.gz
PeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.tar.zst
PeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.zip
Add comments feeds popover in watch page
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts31
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.html5
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.scss3
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comments.component.ts4
4 files changed, 38 insertions, 5 deletions
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 73526cb3e..9bcb4b7de 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
@@ -3,7 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { lineFeedToHtml } from '@app/shared/misc/utils' 4import { lineFeedToHtml } from '@app/shared/misc/utils'
5import { Observable } from 'rxjs' 5import { Observable } from 'rxjs'
6import { ResultList } from '../../../../../../shared/models' 6import { ResultList, FeedFormat } from '../../../../../../shared/models'
7import { 7import {
8 VideoComment as VideoCommentServerModel, 8 VideoComment as VideoCommentServerModel,
9 VideoCommentCreate, 9 VideoCommentCreate,
@@ -18,6 +18,7 @@ import { VideoComment } from './video-comment.model'
18@Injectable() 18@Injectable()
19export class VideoCommentService { 19export class VideoCommentService {
20 private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' 20 private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/'
21 private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.'
21 22
22 constructor ( 23 constructor (
23 private authHttp: HttpClient, 24 private authHttp: HttpClient,
@@ -88,6 +89,34 @@ export class VideoCommentService {
88 ) 89 )
89 } 90 }
90 91
92 getVideoCommentsFeeds (videoUUID?: string) {
93 const feeds = [
94 {
95 format: FeedFormat.RSS,
96 label: 'rss 2.0',
97 url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase()
98 },
99 {
100 format: FeedFormat.ATOM,
101 label: 'atom 1.0',
102 url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase()
103 },
104 {
105 format: FeedFormat.JSON,
106 label: 'json 1.0',
107 url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase()
108 }
109 ]
110
111 if (videoUUID !== undefined) {
112 for (const feed of feeds) {
113 feed.url += '?videoId=' + videoUUID
114 }
115 }
116
117 return feeds
118 }
119
91 private extractVideoComment (videoComment: VideoCommentServerModel) { 120 private extractVideoComment (videoComment: VideoCommentServerModel) {
92 return new VideoComment(videoComment) 121 return new VideoComment(videoComment)
93 } 122 }
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html
index 5aebd7f24..42e129d65 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.html
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html
@@ -3,9 +3,8 @@
3 <div i18n class="title-page title-page-single"> 3 <div i18n class="title-page title-page-single">
4 Comments 4 Comments
5 </div> 5 </div>
6 <my-help 6
7 *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml 7 <my-video-feed [syndicationItems]="syndicationItems"></my-video-feed>
8 customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.name}}@{{video.account.host}}</strong> and find back the video."></my-help>
9 </div> 8 </div>
10 9
11 <ng-template [ngIf]="video.commentsEnabled === true"> 10 <ng-template [ngIf]="video.commentsEnabled === true">
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.scss b/client/src/app/videos/+video-watch/comment/video-comments.component.scss
index 04518e079..dbb44c66c 100644
--- a/client/src/app/videos/+video-watch/comment/video-comments.component.scss
+++ b/client/src/app/videos/+video-watch/comment/video-comments.component.scss
@@ -23,8 +23,9 @@
23 margin-right: 0; 23 margin-right: 0;
24} 24}
25 25
26my-help { 26my-video-feed {
27 display: inline-block; 27 display: inline-block;
28 margin-left: 5px;
28} 29}
29 30
30@media screen and (max-width: 600px) { 31@media screen and (max-width: 600px) {
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 3707a4094..c864d82b7 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
@@ -35,6 +35,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
35 threadComments: { [ id: number ]: VideoCommentThreadTree } = {} 35 threadComments: { [ id: number ]: VideoCommentThreadTree } = {}
36 threadLoading: { [ id: number ]: boolean } = {} 36 threadLoading: { [ id: number ]: boolean } = {}
37 37
38 syndicationItems = []
39
38 private sub: Subscription 40 private sub: Subscription
39 41
40 constructor ( 42 constructor (
@@ -201,6 +203,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
201 this.componentPagination.currentPage = 1 203 this.componentPagination.currentPage = 1
202 this.componentPagination.totalItems = null 204 this.componentPagination.totalItems = null
203 205
206 this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid)
207
204 this.loadMoreComments() 208 this.loadMoreComments()
205 } 209 }
206 } 210 }