+ onThreadCreated (commentTree: VideoCommentThreadTree) {
+ this.viewReplies(commentTree.comment.id)
+ }
+
+ handleSortChange (sort: CommentSortField) {
+ if (this.sort === sort) return
+
+ this.sort = sort
+ this.resetVideo()
+ }
+
+ handleTimestampClicked (timestamp: number) {
+ this.timestampClicked.emit(timestamp)
+ }
+
+ async onWantedToDelete (commentToDelete: VideoComment) {
+ let message = 'Do you really want to delete this comment?'
+
+ if (commentToDelete.isLocal) {
+ message += this.i18n(' The deletion will be sent to remote instances, so they remove the comment too.')
+ } else {
+ message += this.i18n(' It is a remote comment, so the deletion will only be effective on your instance.')
+ }
+
+ const res = await this.confirmService.confirm(message, this.i18n('Delete'))
+ if (res === false) return
+
+ this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id)
+ .subscribe(
+ () => {
+ // Mark the comment as deleted
+ this.softDeleteComment(commentToDelete)
+
+ if (this.highlightedThread.id === commentToDelete.id) this.highlightedThread = undefined
+ },
+
+ err => this.notifier.error(err.message)
+ )
+ }
+