From 53877968a6bff713be6f0e15042e13a5da5e5e1a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 2 Oct 2018 11:14:59 +0200 Subject: Add comments feeds popover in watch page --- .../+video-watch/comment/video-comment.service.ts | 31 +++++++++++++++++++++- .../comment/video-comments.component.html | 5 ++-- .../comment/video-comments.component.scss | 3 ++- .../comment/video-comments.component.ts | 4 +++ 4 files changed, 38 insertions(+), 5 deletions(-) (limited to 'client/src/app/videos') 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' import { Injectable } from '@angular/core' import { lineFeedToHtml } from '@app/shared/misc/utils' import { Observable } from 'rxjs' -import { ResultList } from '../../../../../../shared/models' +import { ResultList, FeedFormat } from '../../../../../../shared/models' import { VideoComment as VideoCommentServerModel, VideoCommentCreate, @@ -18,6 +18,7 @@ import { VideoComment } from './video-comment.model' @Injectable() export class VideoCommentService { private static BASE_VIDEO_URL = environment.apiUrl + '/api/v1/videos/' + private static BASE_FEEDS_URL = environment.apiUrl + '/feeds/video-comments.' constructor ( private authHttp: HttpClient, @@ -88,6 +89,34 @@ export class VideoCommentService { ) } + getVideoCommentsFeeds (videoUUID?: string) { + const feeds = [ + { + format: FeedFormat.RSS, + label: 'rss 2.0', + url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.RSS.toLowerCase() + }, + { + format: FeedFormat.ATOM, + label: 'atom 1.0', + url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.ATOM.toLowerCase() + }, + { + format: FeedFormat.JSON, + label: 'json 1.0', + url: VideoCommentService.BASE_FEEDS_URL + FeedFormat.JSON.toLowerCase() + } + ] + + if (videoUUID !== undefined) { + for (const feed of feeds) { + feed.url += '?videoId=' + videoUUID + } + } + + return feeds + } + private extractVideoComment (videoComment: VideoCommentServerModel) { return new VideoComment(videoComment) } 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 @@
Comments
- + + 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 @@ margin-right: 0; } -my-help { +my-video-feed { display: inline-block; + margin-left: 5px; } @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 { threadComments: { [ id: number ]: VideoCommentThreadTree } = {} threadLoading: { [ id: number ]: boolean } = {} + syndicationItems = [] + private sub: Subscription constructor ( @@ -201,6 +203,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.componentPagination.currentPage = 1 this.componentPagination.totalItems = null + this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video.uuid) + this.loadMoreComments() } } -- cgit v1.2.3