+
+ handleTimestampClicked (timestamp: number) {
+ this.timestampClicked.emit(timestamp)
+ }
+
+ isRemovableByUser () {
+ return this.comment.account && this.isUserLoggedIn() &&
+ (
+ this.user.account.id === this.comment.account.id ||
+ this.user.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT)
+ )
+ }
+
+ switchToDefaultAvatar ($event: Event) {
+ ($event.target as HTMLImageElement).src = Actor.GET_DEFAULT_AVATAR_URL()
+ }
+
+ private getUserIfNeeded (account: Account) {
+ if (!account.userId) return
+ if (!this.authService.isLoggedIn()) return
+
+ const user = this.authService.getUser()
+ if (user.hasRight(UserRight.MANAGE_USERS)) {
+ this.userService.getUserWithCache(account.userId)
+ .subscribe(
+ user => this.commentUser = user,
+
+ err => this.notifier.error(err.message)
+ )
+ }
+ }
+
+ private async init () {
+ const html = await this.markdownService.textMarkdownToHTML(this.comment.text, true)
+ this.sanitizedCommentHTML = await this.markdownService.processVideoTimestamps(html)
+ this.newParentComments = this.parentComments.concat([ this.comment ])
+ this.commentAccount = new Account(this.comment.account)
+ this.getUserIfNeeded(this.commentAccount)
+ }