aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/comment/video-comment.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment.service.ts')
-rw-r--r--client/src/app/videos/+video-watch/comment/video-comment.service.ts31
1 files changed, 30 insertions, 1 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 }