Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Refactor row selection reset

Chocobozzze854d57bed56
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 6dd64fc577..cebb2e1a2d 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 <ActorFollow> 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 e986a610aa..71f2fbe665 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 <ActorFollow> 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 <ActorFollow> 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 <ActorFollow> 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 a89603048c..b31c5b35e6 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 569eccaa2c..ed8fbec518 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 <UserRegistration> 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 efd99e52bc..f365a2500f 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
+ }).subscribe({
+ next: async resultList => {
+ this.totalRecords = resultList.total
- this.blocklist = resultList.data
+ this.blocklist = resultList.data
- for (const element of this.blocklist) {
- Object.assign(element, {
- reasonHtml: await this.toHtml(element.reason)
- })
- }
- },
+ for (const element of this.blocklist) {
+ Object.assign(element, {
+ reasonHtml: await this.toHtml(element.reason)
+ })
+ }
+ },
- error: err => this.notifier.error(err.message)
- })
+ 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 cfa68ed9d5..28efdc0762 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 <VideoCommentAdmin> 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 7d62302f83..19420b7489 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 <User> 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 cd5d2eb34a..1ea2954992 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 <Video> implements OnInit {
return files.reduce((p, f) => p += f.size, 0)
}
- reloadData () {
- this.selectedRows = []
+ async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
+ const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
+ const res = await this.confirmService.confirm(message, $localize`Delete file`)
+ if (res === false) return
+
+ this.videoService.removeFile(video.uuid, file.id, type)
+ .subscribe({
+ next: () => {
+ this.notifier.success($localize`File removed.`)
+ this.reloadData()
+ },
+
+ error: err => this.notifier.error(err.message)
+ })
+ }
+ protected reloadDataInternal () {
this.loading = true
this.videoAdminService.getAdminVideos({
@@ -203,22 +217,6 @@ export class VideoListComponent extends RestTable <Video> implements OnInit {
})
}
- async removeVideoFile (video: Video, file: VideoFile, type: 'hls' | 'webtorrent') {
- const message = $localize`Are you sure you want to delete this ${file.resolution.label} file?`
- const res = await this.confirmService.confirm(message, $localize`Delete file`)
- if (res === false) return
-
- this.videoService.removeFile(video.uuid, file.id, type)
- .subscribe({
- next: () => {
- this.notifier.success($localize`File removed.`)
- this.reloadData()
- },
-
- error: err => this.notifier.error(err.message)
- })
- }
-
private async removeVideos (videos: Video[]) {
const message = prepareIcu($localize`Are you sure you want to delete {count, plural, =1 {this video} other {these {count} videos}}?`)(
{ count: videos.length },
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts
index 12dc88a70c..6e10c81ff2 100644
--- a/client/src/app/+admin/system/jobs/jobs.component.ts
+++ b/client/src/app/+admin/system/jobs/jobs.component.ts
@@ -120,7 +120,7 @@ export class JobsComponent extends RestTable implements OnInit {
this.reloadData()
}
- protected reloadData () {
+ protected reloadDataInternal () {
let jobState = this.jobState as JobState
if (this.jobState === 'all') jobState = null
diff --git a/client/src/app/+my-library/my-ownership/my-ownership.component.ts b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
index 7ea940ceba..8d6a42dfb3 100644
--- a/client/src/app/+my-library/my-ownership/my-ownership.component.ts
+++ b/client/src/app/+my-library/my-ownership/my-ownership.component.ts
@@ -59,7 +59,7 @@ export class MyOwnershipComponent extends RestTable implements OnInit {
})
}
- protected reloadData () {
+ protected reloadDataInternal () {
return this.videoOwnershipService.getOwnershipChanges(this.pagination, this.sort)
.subscribe({
next: resultList => {
diff --git a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
index d18e78201c..74dbe222df 100644
--- a/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
+++ b/client/src/app/+my-library/my-video-channel-syncs/my-video-channel-syncs.component.ts
@@ -68,7 +68,7 @@ export class MyVideoChannelSyncsComponent extends RestTable implements OnInit {
]
}
- protected reloadData () {
+ protected reloadDataInternal () {
this.error = undefined
this.authService.userInformationLoaded
diff --git a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
index 46d689bd1a..7d82f62b93 100644
--- a/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
+++ b/client/src/app/+my-library/my-video-imports/my-video-imports.component.ts
@@ -90,7 +90,7 @@ export class MyVideoImportsComponent extends RestTable implements OnInit {
})
}
- protected reloadData () {
+ protected reloadDataInternal () {
this.videoImportService.getMyVideoImports(this.pagination, this.sort, this.search)
.subscribe({
next: resultList => {
diff --git a/client/src/app/core/rest/rest-table.ts b/client/src/app/core/rest/rest-table.ts
index cfaa16af9c..707110d7f7 100644
--- a/client/src/app/core/rest/rest-table.ts
+++ b/client/src/app/core/rest/rest-table.ts
@@ -81,7 +81,13 @@ export abstract class RestTable <T = unknown> {
return this.selectedRows.length !== 0
}
- protected abstract reloadData (): void
+ protected abstract reloadDataInternal (): void
+
+ protected reloadData () {
+ this.selectedRows = []
+
+ this.reloadDataInternal()
+ }
private getSortLocalStorageKey () {
return 'rest-table-sort-' + this.getIdentifier()
diff --git a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
index 569a37b175..d8470e9277 100644
--- a/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
+++ b/client/src/app/shared/shared-abuse-list/abuse-list-table.component.ts
@@ -175,7 +175,7 @@ export class AbuseListTableComponent extends RestTable implements OnInit {
return Actor.IS_LOCAL(abuse.reporterAccount.host)
}
- protected reloadData () {
+ protected reloadDataInternal () {
debugLogger('Loading data.')
const options = {
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 9ed00bc12f..38dbbff788 100644
--- a/client/src/app/shared/shared-moderation/account-blocklist.component.ts
+++ b/client/src/app/shared/shared-moderation/account-blocklist.component.ts
@@ -48,7 +48,7 @@ export class GenericAccountBlocklistComponent extends RestTable implements OnIni
)
}
- protected reloadData () {
+ protected reloadDataInternal () {
const operation = this.mode === BlocklistComponentType.Account
? this.blocklistService.getUserAccountBlocklist({
pagination: this.pagination,
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 1ba7a1b4d7..f1bcbd5611 100644
--- a/client/src/app/shared/shared-moderation/server-blocklist.component.ts
+++ b/client/src/app/shared/shared-moderation/server-blocklist.component.ts
@@ -75,7 +75,7 @@ export class GenericServerBlocklistComponent extends RestTable implements OnInit
})
}
- protected reloadData () {
+ protected reloadDataInternal () {
const operation = this.mode === BlocklistComponentType.Account
? this.blocklistService.getUserServerBlocklist({
pagination: this.pagination,