Fix i18n on delete modal and linter

This commit is contained in:
kimsible 2020-08-07 23:24:22 +02:00 committed by Chocobozzz
parent 3c176894ba
commit ddb0303f4d
2 changed files with 18 additions and 8 deletions

View File

@ -112,11 +112,21 @@ export class VideoCommentComponent implements OnInit, OnChanges {
} }
isRedraftableByUser () { isRedraftableByUser () {
return this.comment.account && this.isUserLoggedIn() && this.user.account.id === this.comment.account.id && this.comment.totalReplies === 0 return (
this.comment.account &&
this.isUserLoggedIn() &&
this.user.account.id === this.comment.account.id &&
this.comment.totalReplies === 0
)
} }
isReportableByUser () { 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.comment.isDeleted === false &&
this.authService.getUser().account.id !== this.comment.account.id
)
} }
switchToDefaultAvatar ($event: Event) { switchToDefaultAvatar ($event: Event) {

View File

@ -160,15 +160,15 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
this.timestampClicked.emit(timestamp) 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) { if (commentToDelete.isLocal || this.video.isLocal) {
message += $localize` The deletion will be sent to remote instances so they can reflect the change.` message += $localize` The deletion will be sent to remote instances so they can reflect the change.`
} else { } else {
message += $localize` It is a remote comment, so the deletion will only be effective on your instance.` 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`) const res = await this.confirmService.confirm(message, title)
if (res === false) return if (res === false) return false
this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id)
.subscribe( .subscribe(
@ -190,7 +190,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
} }
async onWantedToRedraft (commentToRedraft: VideoComment) { 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, $localize`Delete and re-draft`, $localize`Do you really want to delete and re-draft this comment?`)
if (confirm) { if (confirm) {
this.inReplyToCommentId = commentToRedraft.inReplyToCommentId this.inReplyToCommentId = commentToRedraft.inReplyToCommentId