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',
}
},
- 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)
+ }
})
}
this.syndicationItems = this.videoCommentService.getVideoCommentsFeeds(this.video)
this.loadMoreThreads()
+
+ if (this.activatedRoute.params['threadId']) {
+ this.processHighlightedThread(+this.activatedRoute.params['threadId'])
+ }
}
}
if (this.player) this.player.pause()
+ this.video = undefined
+
const videoObs = this.hooks.wrapObsFun(
this.videoService.getVideo.bind(this.videoService),
{ videoId },
import express from 'express'
import { VideoCommentModel } from '@server/models/video/video-comment'
import { MVideoId } from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ServerErrorCode } from '@shared/models'
async function doesVideoCommentThreadExist (idArg: number | string, video: MVideoId, res: express.Response) {
const id = parseInt(idArg + '', 10)
}
if (videoComment.videoId !== video.id) {
- res.fail({ message: 'Video comment is not associated to this video.' })
+ res.fail({
+ type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
+ message: 'Video comment is not associated to this video.'
+ })
return false
}
}
if (videoComment.videoId !== video.id) {
- res.fail({ message: 'Video comment is not associated to this video.' })
+ res.fail({
+ type: ServerErrorCode.COMMENT_NOT_ASSOCIATED_TO_VIDEO,
+ message: 'Video comment is not associated to this video.'
+ })
return false
}
* A torrent should have at most one correct video file. Any more and we will
* not be able to choose automatically.
*/
- INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent'
+ INCORRECT_FILES_IN_TORRENT = 'incorrect_files_in_torrent',
+
+ COMMENT_NOT_ASSOCIATED_TO_VIDEO = 'comment_not_associated_to_video'
}
/**