feat(plugins): add filter:admin-comment-list.actions.create.result

pull/6692/head
kontrollanten 2024-03-14 09:58:09 +01:00
parent 892bb40226
commit ad6b7371e4
4 changed files with 19 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import { DatePipe, NgClass, NgIf } from '@angular/common'
import { Component, Input, OnInit } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
import { AuthService, ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
import { AuthService, ConfirmService, HooksService, MarkdownService, Notifier, PluginService, RestPagination, RestTable } from '@app/core'
import { formatICU } from '@app/helpers'
import { BulkService } from '@app/shared/shared-moderation/bulk.service'
import { VideoCommentForAdminOrUser } from '@app/shared/shared-video-comment/video-comment.model'
@ -68,11 +68,18 @@ export class VideoCommentListAdminOwnerComponent extends RestTable <VideoComment
private confirmService: ConfirmService,
private videoCommentService: VideoCommentService,
private markdownRenderer: MarkdownService,
private bulkService: BulkService
private bulkService: BulkService,
private hooks: HooksService,
private pluginService: PluginService
) {
super()
}
this.videoCommentActions = [
async ngOnInit () {
this.initialize()
await this.pluginService.ensurePluginsAreLoaded('admin-comments')
const videoCommentActions: DropdownAction<VideoCommentForAdminOrUser>[][] = [
[
{
label: $localize`Delete this comment`,
@ -94,12 +101,9 @@ export class VideoCommentListAdminOwnerComponent extends RestTable <VideoComment
}
]
]
}
this.videoCommentActions = await this.hooks.wrapObject(videoCommentActions, 'admin-comments', 'filter:admin-video-comment-list.actions.create.result')
ngOnInit () {
this.initialize()
this.bulkActions = [
const bulkActions: DropdownAction<VideoCommentForAdminOrUser[]>[] = [
{
label: $localize`Delete`,
handler: comments => this.removeComments(comments),

View File

@ -72,7 +72,8 @@ class PluginsManager {
'my-library': new ReplaySubject<boolean>(1),
'video-channel': new ReplaySubject<boolean>(1),
'my-account': new ReplaySubject<boolean>(1),
'admin-users': new ReplaySubject<boolean>(1)
'admin-users': new ReplaySubject<boolean>(1),
'admin-comments': new ReplaySubject<boolean>(1)
}
private readonly peertubeHelpersFactory: PeertubeHelpersFactory

View File

@ -102,6 +102,9 @@ export const clientFilterHookObject = {
// Filter bulk actions in user list
'filter:admin-user-list.bulk-actions.create.result': true,
// Filter actions in comment list
'filter:admin-video-comment-list.actions.create.result': true,
// Filter user moderation actions
'filter:admin-user-moderation.actions.create.result': true
}

View File

@ -10,4 +10,5 @@ export type PluginClientScope =
'my-library' |
'video-channel' |
'my-account' |
'admin-users'
'admin-users' |
'admin-comments'