mirror of https://github.com/Chocobozzz/PeerTube
feat(plugins): add filter:admin-user-moderation.actions.create.result
parent
c1a8904154
commit
892bb40226
|
@ -1,5 +1,5 @@
|
||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
|
||||||
import { AuthService, ConfirmService, Notifier, ServerService } from '@app/core'
|
import { AuthService, ConfirmService, HooksService, Notifier, PluginService, ServerService } from '@app/core'
|
||||||
import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'
|
import { BulkRemoveCommentsOfBody, User, UserRight } from '@peertube/peertube-models'
|
||||||
import { BlocklistService } from './blocklist.service'
|
import { BlocklistService } from './blocklist.service'
|
||||||
import { BulkService } from './bulk.service'
|
import { BulkService } from './bulk.service'
|
||||||
|
@ -58,7 +58,9 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private userAdminService: UserAdminService,
|
private userAdminService: UserAdminService,
|
||||||
private blocklistService: BlocklistService,
|
private blocklistService: BlocklistService,
|
||||||
private bulkService: BulkService
|
private bulkService: BulkService,
|
||||||
|
private hooks: HooksService,
|
||||||
|
private pluginService: PluginService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
ngOnInit () {
|
||||||
|
@ -66,7 +68,8 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
|
||||||
.subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
|
.subscribe(config => this.requiresEmailVerification = config.signup.requiresEmailVerification)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges () {
|
async ngOnChanges () {
|
||||||
|
await this.pluginService.ensurePluginsAreLoaded('admin-users')
|
||||||
this.buildActions()
|
this.buildActions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,20 +274,20 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {
|
||||||
return account && this.authService.getUser().account.id === account.id
|
return account && this.authService.getUser().account.id === account.id
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildActions () {
|
private async buildActions () {
|
||||||
this.userActions = []
|
const userActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[][] = []
|
||||||
|
|
||||||
if (this.prependActions && this.prependActions.length !== 0) {
|
if (this.prependActions && this.prependActions.length !== 0) {
|
||||||
this.userActions = [
|
userActions.push(this.prependActions)
|
||||||
this.prependActions
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const myAccountModerationActions = this.buildMyAccountModerationActions()
|
const myAccountModerationActions = this.buildMyAccountModerationActions()
|
||||||
const instanceModerationActions = this.buildInstanceModerationActions()
|
const instanceModerationActions = this.buildInstanceModerationActions()
|
||||||
|
|
||||||
if (myAccountModerationActions.length !== 0) this.userActions.push(myAccountModerationActions)
|
if (myAccountModerationActions.length !== 0) userActions.push(myAccountModerationActions)
|
||||||
if (instanceModerationActions.length !== 0) this.userActions.push(instanceModerationActions)
|
if (instanceModerationActions.length !== 0) userActions.push(instanceModerationActions)
|
||||||
|
|
||||||
|
this.userActions = await this.hooks.wrapObject(userActions, 'admin-users', 'filter:admin-user-moderation.actions.create.result')
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildMyAccountModerationActions () {
|
private buildMyAccountModerationActions () {
|
||||||
|
|
|
@ -100,7 +100,10 @@ export const clientFilterHookObject = {
|
||||||
'filter:internal.player.p2p-media-loader.options.result': true,
|
'filter:internal.player.p2p-media-loader.options.result': true,
|
||||||
|
|
||||||
// Filter bulk actions in user list
|
// Filter bulk actions in user list
|
||||||
'filter:admin-user-list.bulk-actions.create.result': true
|
'filter:admin-user-list.bulk-actions.create.result': true,
|
||||||
|
|
||||||
|
// Filter user moderation actions
|
||||||
|
'filter:admin-user-moderation.actions.create.result': true
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ClientFilterHookName = keyof typeof clientFilterHookObject
|
export type ClientFilterHookName = keyof typeof clientFilterHookObject
|
||||||
|
|
Loading…
Reference in New Issue