diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-02 11:14:59 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-02 11:19:12 +0200 |
commit | 53877968a6bff713be6f0e15042e13a5da5e5e1a (patch) | |
tree | 5c88ce7aa0b578e667c35a13c874734838779575 /client/src/app/videos/+video-watch/comment/video-comment.service.ts | |
parent | d95fdb5af958f84af876356e4293ae2d1be05161 (diff) | |
download | PeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.tar.gz PeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.tar.zst PeerTube-53877968a6bff713be6f0e15042e13a5da5e5e1a.zip |
Add comments feeds popover in watch page
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.ts | 31 |
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' | |||
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { lineFeedToHtml } from '@app/shared/misc/utils' | 4 | import { lineFeedToHtml } from '@app/shared/misc/utils' |
5 | import { Observable } from 'rxjs' | 5 | import { Observable } from 'rxjs' |
6 | import { ResultList } from '../../../../../../shared/models' | 6 | import { ResultList, FeedFormat } from '../../../../../../shared/models' |
7 | import { | 7 | import { |
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() |
19 | export class VideoCommentService { | 19 | export 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 | } |