From 1378c0d343028f3d40d7d795422684ab9e6a1599 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Aug 2021 11:27:47 +0200 Subject: Fix client lint --- .../account-blocklist.component.ts | 8 +- .../report-modals/account-report.component.ts | 8 +- .../report-modals/comment-report.component.ts | 8 +- .../report-modals/video-report.component.ts | 8 +- .../server-blocklist.component.ts | 8 +- .../shared-moderation/user-ban-modal.component.ts | 8 +- .../user-moderation-dropdown.component.ts | 112 +++++++++++---------- .../shared-moderation/video-block.component.ts | 8 +- 8 files changed, 85 insertions(+), 83 deletions(-) (limited to 'client/src/app/shared/shared-moderation') diff --git a/client/src/app/shared/shared-moderation/account-blocklist.component.ts b/client/src/app/shared/shared-moderation/account-blocklist.component.ts index 1146aeec0..36f2a591b 100644 --- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts @@ -62,13 +62,13 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni search: this.search }) - return operation.subscribe( - resultList => { + return operation.subscribe({ + next: resultList => { this.blockedAccounts = resultList.data this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts index cc8875f77..4ec02f11a 100644 --- a/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/account-report.component.ts @@ -77,14 +77,14 @@ export class AccountReportComponent extends FormReactive implements OnInit { account: { id: this.account.id } - }).subscribe( - () => { + }).subscribe({ + next: () => { this.notifier.success($localize`Account reported.`) this.hide() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } isRemote () { diff --git a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts index c7395c7b7..7c0907ce4 100644 --- a/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/comment-report.component.ts @@ -77,14 +77,14 @@ export class CommentReportComponent extends FormReactive implements OnInit { comment: { id: this.comment.id } - }).subscribe( - () => { + }).subscribe({ + next: () => { this.notifier.success($localize`Comment reported.`) this.hide() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } isRemote () { diff --git a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts index e509ac88f..278d60ac6 100644 --- a/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts +++ b/client/src/app/shared/shared-moderation/report-modals/video-report.component.ts @@ -108,14 +108,14 @@ export class VideoReportComponent extends FormReactive implements OnInit { startAt: hasStart && startAt ? startAt : undefined, endAt: hasEnd && endAt ? endAt : undefined } - }).subscribe( - () => { + }).subscribe({ + next: () => { this.notifier.success($localize`Video reported.`) this.hide() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } isRemote () { diff --git a/client/src/app/shared/shared-moderation/server-blocklist.component.ts b/client/src/app/shared/shared-moderation/server-blocklist.component.ts index 274d8f6e9..da09b1d0e 100644 --- a/client/src/app/shared/shared-moderation/server-blocklist.component.ts +++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts @@ -88,13 +88,13 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit search: this.search }) - return operation.subscribe( - resultList => { + return operation.subscribe({ + next: resultList => { this.blockedServers = resultList.data this.totalRecords = resultList.total }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts index afc69a1b8..0a2d5e93a 100644 --- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts +++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts @@ -47,8 +47,8 @@ export class UserBanModalComponent extends FormReactive implements OnInit { const reason = this.form.value['reason'] || undefined this.userService.banUsers(this.usersToBan, reason) - .subscribe( - () => { + .subscribe({ + next: () => { const message = Array.isArray(this.usersToBan) ? $localize`${this.usersToBan.length} users banned.` : $localize`User ${this.usersToBan.username} banned.` @@ -59,8 +59,8 @@ export class UserBanModalComponent extends FormReactive implements OnInit { this.hide() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } diff --git a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts index 8c5a48d42..9f1e1bf9b 100644 --- a/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts +++ b/client/src/app/shared/shared-moderation/user-moderation-dropdown.component.ts @@ -67,14 +67,14 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges { if (res === false) return this.userService.unbanUsers(user) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`User ${user.username} unbanned.`) this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } async removeUser (user: User) { @@ -87,137 +87,139 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges { const res = await this.confirmService.confirm(message, $localize`Delete`) if (res === false) return - this.userService.removeUser(user).subscribe( - () => { - this.notifier.success($localize`User ${user.username} deleted.`) - this.userDeleted.emit() - }, + this.userService.removeUser(user) + .subscribe({ + next: () => { + this.notifier.success($localize`User ${user.username} deleted.`) + this.userDeleted.emit() + }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } setEmailAsVerified (user: User) { - this.userService.updateUser(user.id, { emailVerified: true }).subscribe( - () => { - this.notifier.success($localize`User ${user.username} email set as verified`) - this.userChanged.emit() - }, - - err => this.notifier.error(err.message) - ) + this.userService.updateUser(user.id, { emailVerified: true }) + .subscribe({ + next: () => { + this.notifier.success($localize`User ${user.username} email set as verified`) + this.userChanged.emit() + }, + + error: err => this.notifier.error(err.message) + }) } blockAccountByUser (account: Account) { this.blocklistService.blockAccountByUser(account) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Account ${account.nameWithHost} muted.`) this.account.mutedByUser = true this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } unblockAccountByUser (account: Account) { this.blocklistService.unblockAccountByUser(account) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Account ${account.nameWithHost} unmuted.`) this.account.mutedByUser = false this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } blockServerByUser (host: string) { this.blocklistService.blockServerByUser(host) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Instance ${host} muted.`) this.account.mutedServerByUser = true this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } unblockServerByUser (host: string) { this.blocklistService.unblockServerByUser(host) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Instance ${host} unmuted.`) this.account.mutedServerByUser = false this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } blockAccountByInstance (account: Account) { this.blocklistService.blockAccountByInstance(account) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`) this.account.mutedByInstance = true this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } unblockAccountByInstance (account: Account) { this.blocklistService.unblockAccountByInstance(account) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Account ${account.nameWithHost} unmuted by the instance.`) this.account.mutedByInstance = false this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } blockServerByInstance (host: string) { this.blocklistService.blockServerByInstance(host) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Instance ${host} muted by the instance.`) this.account.mutedServerByInstance = true this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } unblockServerByInstance (host: string) { this.blocklistService.unblockServerByInstance(host) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Instance ${host} unmuted by the instance.`) this.account.mutedServerByInstance = false this.userChanged.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } async bulkRemoveCommentsOf (body: BulkRemoveCommentsOfBody) { @@ -226,13 +228,13 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges { if (res === false) return this.bulkService.removeCommentsOf(body) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Will remove comments of this account (may take several minutes).`) }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } getRouterUserEditLink (user: User) { diff --git a/client/src/app/shared/shared-moderation/video-block.component.ts b/client/src/app/shared/shared-moderation/video-block.component.ts index fb47989dc..bc6952620 100644 --- a/client/src/app/shared/shared-moderation/video-block.component.ts +++ b/client/src/app/shared/shared-moderation/video-block.component.ts @@ -55,8 +55,8 @@ export class VideoBlockComponent extends FormReactive implements OnInit { const unfederate = this.video.isLocal ? this.form.value[ 'unfederate' ] : undefined this.videoBlocklistService.blockVideo(this.video.id, reason, unfederate) - .subscribe( - () => { + .subscribe({ + next: () => { this.notifier.success($localize`Video blocked.`) this.hide() @@ -66,7 +66,7 @@ export class VideoBlockComponent extends FormReactive implements OnInit { this.videoBlocked.emit() }, - err => this.notifier.error(err.message) - ) + error: err => this.notifier.error(err.message) + }) } } -- cgit v1.2.3