From fe02077f5619eccf3c6789dee2647963c118322d Mon Sep 17 00:00:00 2001 From: kimsible Date: Fri, 7 Aug 2020 23:24:22 +0200 Subject: [PATCH] Fix i18n on delete modal and linter --- .../comment/video-comment.component.ts | 20 ++++++++++++++----- .../comment/video-comments.component.ts | 6 +++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts index d897a477fb62..502da99efcaf 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts @@ -114,11 +114,21 @@ export class VideoCommentComponent implements OnInit, OnChanges { } isRedraftableByUser () { - return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0 - } - - isReportableByUser() { - return this.comment.account && this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id + return ( + this.comment.account && + this.isUserLoggedIn() && + this.user.account.id === this.comment.account.id && + this.comment.totalReplies === 0 + ) + } + + isReportableByUser () { + return ( + this.comment.account && + this.isUserLoggedIn() && + this.comment.isDeleted === false && + this.authService.getUser().account.id !== this.comment.account.id + ) } switchToDefaultAvatar ($event: Event) { diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts index 2c3890d01bf5..a66bc3f6ba29 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts @@ -162,14 +162,14 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { this.timestampClicked.emit(timestamp) } - async onWantedToDelete (commentToDelete: VideoComment, message = 'Do you really want to delete this comment?'): Promise { + async onWantedToDelete(commentToDelete: VideoComment, title = this.i18n('Delete'), message = this.i18n('Do you really want to delete this comment?')): Promise { if (commentToDelete.isLocal || this.video.isLocal) { message += this.i18n(' The deletion will be sent to remote instances so they can reflect the change.') } 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')) + const res = await this.confirmService.confirm(message, title) if (res === false) return false this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) @@ -192,7 +192,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { } async onWantedToRedraft(commentToRedraft: VideoComment) { - const confirm = await this.onWantedToDelete(commentToRedraft, 'Do you really want to delete and re-draft this comment?') + const confirm = await this.onWantedToDelete(commentToRedraft, this.i18n('Delete and re-draft'), this.i18n('Do you really want to delete and re-draft this comment?')) if (confirm) { this.inReplyToCommentId = commentToRedraft.inReplyToCommentId