]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix i18n on delete modal and linter
authorkimsible <kimsible@users.noreply.github.com>
Fri, 7 Aug 2020 21:24:22 +0000 (23:24 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Fri, 14 Aug 2020 13:03:38 +0000 (15:03 +0200)
client/src/app/+videos/+video-watch/comment/video-comment.component.ts
client/src/app/+videos/+video-watch/comment/video-comments.component.ts

index 8473350be2e447c17de9e138cf292907b6b5385d..fe069b54c3cb6521e0040fbe64182e8efd55c616 100644 (file)
@@ -112,11 +112,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) {
index 8080afd8d6e050bc4075c89aa97ae62b49200002..9e8e143c257e658856e4dcdfbaca2a12de324968 100644 (file)
@@ -160,15 +160,15 @@ 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<boolean> {
+  async onWantedToDelete(commentToDelete: VideoComment, title = $localize`Delete`, message = $localize`Do you really want to delete this comment?`): Promise<boolean> {
     if (commentToDelete.isLocal || this.video.isLocal) {
       message += $localize` The deletion will be sent to remote instances so they can reflect the change.`
     } else {
       message += $localize` It is a remote comment, so the deletion will only be effective on your instance.`
     }
 
-    const res = await this.confirmService.confirm(message, $localize`Delete`)
-    if (res === false) return
+    const res = await this.confirmService.confirm(message, title)
+    if (res === false) return false
 
     this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id)
       .subscribe(
@@ -189,8 +189,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
     return true
   }
 
-  async onWantedToRedraft(commentToRedraft: VideoComment) {
-    const confirm = await this.onWantedToDelete(commentToRedraft, 'Do you really want to delete and re-draft this comment?')
+  async onWantedToRedraft (commentToRedraft: VideoComment) {
+    const confirm = await this.onWantedToDelete(commentToRedraft, $localize`Delete and re-draft`, $localize`Do you really want to delete and re-draft this comment?`)
 
     if (confirm) {
       this.inReplyToCommentId = commentToRedraft.inReplyToCommentId