X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-watch%2Fshared%2Fcomment%2Fvideo-comments.component.ts;h=96bdb28c9088128627e533b3cb7f54bd9096bfa6;hb=54909304287f3c04dcfb39660be8ead57dc95440;hp=8e556c58f6ef3bb88a4b9fabec4df99d00d1a4f4;hpb=7c07259ae5c7b636d52b8ec103a19d31c2f5b755;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts index 8e556c58f..96bdb28c9 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts @@ -5,6 +5,7 @@ import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifie import { HooksService } from '@app/core/plugins/hooks.service' import { Syndication, VideoDetails } from '@app/shared/shared-main' import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment' +import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' @Component({ selector: 'my-video-comments', @@ -104,7 +105,14 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { } }, - error: err => this.notifier.error(err.message) + error: err => { + // We may try to fetch highlighted thread of another video, skip the error if it is the case + // We'll retry the request on video Input() change + const errorBody = err.body as PeerTubeProblemDocument + if (highlightThread && errorBody?.code === ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO) return + + this.notifier.error(err.message) + } }) } @@ -130,6 +138,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.totalNotDeletedComments = res.totalNotDeletedComments this.onDataSubject.next(res.data) + this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) }, @@ -253,6 +262,10 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video) this.loadMoreThreads() + + if (this.activatedRoute.snapshot.params['threadId']) { + this.processHighlightedThread(+this.activatedRoute.snapshot.params['threadId']) + } } }