diff options
author | Chocobozzz <me@florianbigard.com> | 2022-07-29 10:32:56 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-07-29 10:32:56 +0200 |
commit | 5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d (patch) | |
tree | c290f24a6b05dcb57387ad984b51de80f353c56f /client/src/app | |
parent | 37b1d97f226aa83f47cb27eae00f2d2821759457 (diff) | |
download | PeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.tar.gz PeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.tar.zst PeerTube-5a9a56b78f6a62b3241f0dff1b8685001a3b3a1d.zip |
Prevent error on highlighted thread
Diffstat (limited to 'client/src/app')
-rw-r--r-- | client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts | 14 | ||||
-rw-r--r-- | client/src/app/+videos/+video-watch/video-watch.component.ts | 2 |
2 files changed, 15 insertions, 1 deletions
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 1652fd3c4..108ad63e3 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 | |||
5 | import { HooksService } from '@app/core/plugins/hooks.service' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' | 6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' |
7 | import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment' | 7 | import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment' |
8 | import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-video-comments', | 11 | selector: 'my-video-comments', |
@@ -104,7 +105,14 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
104 | } | 105 | } |
105 | }, | 106 | }, |
106 | 107 | ||
107 | error: err => this.notifier.error(err.message) | 108 | error: err => { |
109 | // We may try to fetch highlighted thread of another video, skip the error if it is the case | ||
110 | // We'll retry the request on video Input() change | ||
111 | const errorBody = err.body as PeerTubeProblemDocument | ||
112 | if (highlightThread && errorBody?.code === ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO) return | ||
113 | |||
114 | this.notifier.error(err.message) | ||
115 | } | ||
108 | }) | 116 | }) |
109 | } | 117 | } |
110 | 118 | ||
@@ -254,6 +262,10 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
254 | 262 | ||
255 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video) | 263 | this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video) |
256 | this.loadMoreThreads() | 264 | this.loadMoreThreads() |
265 | |||
266 | if (this.activatedRoute.params['threadId']) { | ||
267 | this.processHighlightedThread(+this.activatedRoute.params['threadId']) | ||
268 | } | ||
257 | } | 269 | } |
258 | } | 270 | } |
259 | 271 | ||
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 292ce6441..8d9c08ab3 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -242,6 +242,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
242 | 242 | ||
243 | if (this.player) this.player.pause() | 243 | if (this.player) this.player.pause() |
244 | 244 | ||
245 | this.video = undefined | ||
246 | |||
245 | const videoObs = this.hooks.wrapObsFun( | 247 | const videoObs = this.hooks.wrapObsFun( |
246 | this.videoService.getVideo.bind(this.videoService), | 248 | this.videoService.getVideo.bind(this.videoService), |
247 | { videoId }, | 249 | { videoId }, |