From e854d57bed56bcbba4d191af54125ae6dd569a88 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Jan 2023 15:06:08 +0100 Subject: [PATCH] Refactor row selection reset --- .../followers-list.component.ts | 2 +- .../following-list.component.ts | 8 +++-- .../video-redundancies-list.component.ts | 2 +- .../registration-list.component.ts | 2 +- .../video-block-list.component.ts | 31 ++++++++--------- .../comments/video-comment-list.component.ts | 2 +- .../users/user-list/user-list.component.ts | 4 +-- .../overview/videos/video-list.component.ts | 34 +++++++++---------- .../app/+admin/system/jobs/jobs.component.ts | 2 +- .../my-ownership/my-ownership.component.ts | 2 +- .../my-video-channel-syncs.component.ts | 2 +- .../my-video-imports.component.ts | 2 +- client/src/app/core/rest/rest-table.ts | 8 ++++- .../abuse-list-table.component.ts | 2 +- .../account-blocklist.component.ts | 2 +- .../server-blocklist.component.ts | 2 +- 16 files changed, 55 insertions(+), 52 deletions(-) diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index 6dd64fc57..cebb2e1a2 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts @@ -140,7 +140,7 @@ export class FollowersListComponent extends RestTable implements O return follow.follower.name + '@' + follow.follower.host } - protected reloadData () { + protected reloadDataInternal () { this.followService.getFollowers({ pagination: this.pagination, sort: this.sort, search: this.search }) .subscribe({ next: resultList => { diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index e986a610a..71f2fbe66 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts @@ -62,8 +62,10 @@ export class FollowingListComponent extends RestTable implements O } async removeFollowing (follows: ActorFollow[]) { + const icuParams = { count: follows.length, entryName: this.buildFollowingName(follows[0]) } + const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)( - { count: follows.length, entryName: this.buildFollowingName(follows[0]) }, + icuParams, $localize`Do you really want to unfollow these entries?` ) @@ -75,7 +77,7 @@ export class FollowingListComponent extends RestTable implements O next: () => { // eslint-disable-next-line max-len const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)( - { count: follows.length, entryName: this.buildFollowingName(follows[0]) }, + icuParams, $localize`You are not following them anymore.` ) @@ -87,7 +89,7 @@ export class FollowingListComponent extends RestTable implements O }) } - protected reloadData () { + protected reloadDataInternal () { this.followService.getFollowing({ pagination: this.pagination, sort: this.sort, search: this.search }) .subscribe({ next: resultList => { diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts index a89603048..b31c5b35e 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts @@ -162,7 +162,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit } - protected reloadData () { + protected reloadDataInternal () { const options = { pagination: this.pagination, sort: this.sort, diff --git a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts index 569eccaa2..ed8fbec51 100644 --- a/client/src/app/+admin/moderation/registration-list/registration-list.component.ts +++ b/client/src/app/+admin/moderation/registration-list/registration-list.component.ts @@ -92,7 +92,7 @@ export class RegistrationListComponent extends RestTable impl this.reloadData() } - protected reloadData () { + protected reloadDataInternal () { this.adminRegistrationService.listRegistrations({ pagination: this.pagination, sort: this.sort, diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index efd99e52b..f365a2500 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts @@ -159,26 +159,25 @@ export class VideoBlockListComponent extends RestTable implements OnInit { }) } - protected reloadData () { + protected reloadDataInternal () { this.videoBlocklistService.listBlocks({ pagination: this.pagination, sort: this.sort, search: this.search + }).subscribe({ + next: async resultList => { + this.totalRecords = resultList.total + + this.blocklist = resultList.data + + for (const element of this.blocklist) { + Object.assign(element, { + reasonHtml: await this.toHtml(element.reason) + }) + } + }, + + error: err => this.notifier.error(err.message) }) - .subscribe({ - next: async resultList => { - this.totalRecords = resultList.total - - this.blocklist = resultList.data - - for (const element of this.blocklist) { - Object.assign(element, { - reasonHtml: await this.toHtml(element.reason) - }) - } - }, - - error: err => this.notifier.error(err.message) - }) } } diff --git a/client/src/app/+admin/overview/comments/video-comment-list.component.ts b/client/src/app/+admin/overview/comments/video-comment-list.component.ts index cfa68ed9d..28efdc076 100644 --- a/client/src/app/+admin/overview/comments/video-comment-list.component.ts +++ b/client/src/app/+admin/overview/comments/video-comment-list.component.ts @@ -117,7 +117,7 @@ export class VideoCommentListComponent extends RestTable imp return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true }) } - reloadData () { + protected reloadDataInternal () { this.videoCommentService.getAdminVideoComments({ pagination: this.pagination, sort: this.sort, diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts index 7d62302f8..19420b748 100644 --- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts @@ -283,9 +283,7 @@ export class UserListComponent extends RestTable implements OnInit { }) } - protected reloadData () { - this.selectedRows = [] - + protected reloadDataInternal () { this.userAdminService.getUsers({ pagination: this.pagination, sort: this.sort, diff --git a/client/src/app/+admin/overview/videos/video-list.component.ts b/client/src/app/+admin/overview/videos/video-list.component.ts index cd5d2eb34..1ea295499 100644 --- a/client/src/app/+admin/overview/videos/video-list.component.ts +++ b/client/src/app/+admin/overview/videos/video-list.component.ts @@ -183,9 +183,23 @@ export class VideoListComponent extends RestTable