X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-watch%2Fcomment%2Fvideo-comment.service.ts;h=0b071539075aa43b648fcc642251462145a19d9a;hb=be27ef3b4682c5639039474c39ee0d234d16f482;hp=a81e5236a596e096c51fe673c2f28dd16284bbd5;hpb=361dcebc75dea74947b6c3aafd9d7d720c054b01;p=github%2FChocobozzz%2FPeerTube.git 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 a81e5236a..0b0715390 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 @@ -7,13 +7,14 @@ import { FeedFormat, ResultList } from '../../../../../../shared/models' import { VideoComment as VideoCommentServerModel, VideoCommentCreate, - VideoCommentThreadTree + VideoCommentThreadTree as VideoCommentThreadTreeServerModel } from '../../../../../../shared/models/videos/video-comment.model' import { environment } from '../../../../environments/environment' import { RestExtractor, RestService } from '../../../shared/rest' import { ComponentPaginationLight } from '../../../shared/rest/component-pagination.model' import { CommentSortField } from '../../../shared/video/sort-field.type' import { VideoComment } from './video-comment.model' +import { VideoCommentThreadTree } from '@app/videos/+video-watch/comment/video-comment-thread-tree.model' @Injectable() export class VideoCommentService { @@ -76,9 +77,9 @@ export class VideoCommentService { const url = `${VideoCommentService.BASE_VIDEO_URL + videoId}/comment-threads/${threadId}` return this.authHttp - .get(url) + .get(url) .pipe( - map(tree => this.extractVideoCommentTree(tree as VideoCommentThreadTree)), + map(tree => this.extractVideoCommentTree(tree)), catchError(err => this.restExtractor.handleError(err)) ) } @@ -138,12 +139,12 @@ export class VideoCommentService { return { data: comments, total: totalComments } } - private extractVideoCommentTree (tree: VideoCommentThreadTree) { - if (!tree) return tree + private extractVideoCommentTree (tree: VideoCommentThreadTreeServerModel) { + if (!tree) return tree as VideoCommentThreadTree tree.comment = new VideoComment(tree.comment) tree.children.forEach(c => this.extractVideoCommentTree(c)) - return tree + return tree as VideoCommentThreadTree } }