ActivityPub-federated video streaming platform using P2P directly in your web browser
Reorder user actions
Chocobozzz0696161f7a53
diff --git a/client/src/app/shared/shared-main/buttons/action-dropdown.component.html b/client/src/app/shared/shared-main/buttons/action-dropdown.component.htmlindex a3c955df56..232723d314 100644--- a/client/src/app/shared/shared-main/buttons/action-dropdown.component.html+++ b/client/src/app/shared/shared-main/buttons/action-dropdown.component.html@@ -42,12 +42,15 @@} @else if (action.actorAvatar) {<my-actor-avatar size="24" [actor]="action.actorAvatar.actor" [actorType]="action.actorAvatar.type"></my-actor-avatar>}+<div class="item-label"><span class="d-inline-flex align-items-center">{{ action.label }}+@if (dropdownItemExtra) {<ng-template *ngTemplateOutlet="dropdownItemExtra; context: { action }"></ng-template>}+@if (action.ownerOrModeratorPrivilege && action.ownerOrModeratorPrivilege()) {<my-global-iconiconName="shield"@@ -56,6 +59,7 @@></my-global-icon>}</span>+@if (action.description) {<small class="muted action-description">{{ action.description }}</small>}@@ -95,6 +99,7 @@</div>}}+@if (areActionsDisplayed(actions, entry())) {<div class="dropdown-divider"></div>}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.tsindex a3ce598b32..07f1bb1feb 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@@ -297,7 +297,7 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {const instanceModerationActions = this.buildInstanceModerationActions()if (myAccountModerationActions.length !== 0) userActions.push(myAccountModerationActions)- if (instanceModerationActions.length !== 0) userActions.push(instanceModerationActions)+ if (instanceModerationActions.length !== 0) userActions.push(...instanceModerationActions)this.userActions = await this.hooks.wrapObject(userActions, 'moderation', 'filter:user-moderation.actions.create.result')}@@ -308,7 +308,6 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {const myAccountActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = [{label: $localize`My account moderation`,- class: [ 'red' ],isHeader: true},{@@ -351,35 +350,28 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {const authUser = this.authService.getUser()- let instanceActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = []+ const instanceActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[][] = []const displayOptions = this.displayOptions()- const userValue = this.user()- if (userValue && displayOptions.instanceUser && authUser.hasRight(UserRight.MANAGE_USERS) && authUser.canManage(userValue)) {- instanceActions = instanceActions.concat([++ const hasManageRight = this.user() && displayOptions.instanceUser && authUser.hasRight(UserRight.MANAGE_USERS) &&+ authUser.canManage(this.user())++ const hasAccountBlocklistRight = this.account() && displayOptions.instanceAccount &&+ authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)+ const hasServerBlocklistRight = displayOptions.instanceAccount && authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)+ const hasBulkRemoveCommentsRight = displayOptions.instanceAccount && authUser.hasRight(UserRight.MANAGE_ANY_VIDEO_COMMENT)++ if (hasManageRight) {+ instanceActions.push([+ { label: $localize`Manage user`, isHeader: true },+{label: $localize`Edit user`,description: $localize`Change quota, role, and more.`,linkBuilder: ({ user }) => this.getRouterUserEditLink(user)},- {- label: $localize`Delete user`,- description: $localize`Videos will be deleted, comments will be tombstoned.`,- isDisplayed: ({ user }) => !this.isMyUser(user),- handler: ({ user }) => this.removeUser(user)- },- {- label: $localize`Ban`,- description: $localize`User won't be able to login anymore, but videos and comments will be kept as is.`,- handler: ({ user }) => this.openBanUserModal(user),- isDisplayed: ({ user }) => !this.isMyUser(user) && !user.blocked- },- {- label: $localize`Unban user`,- description: $localize`Allow the user to login and create videos/comments again`,- handler: ({ user }) => this.unbanUser(user),- isDisplayed: ({ user }) => !this.isMyUser(user) && user.blocked- },+{label: $localize`Set email as verified`,handler: ({ user }) => this.setEmailAsVerified(user),@@ -394,27 +386,54 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {}// Instance actions on account blocklists- const accountValue = this.account()- if (accountValue && displayOptions.instanceAccount && authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) {- instanceActions = instanceActions.concat([- {- label: $localize`Mute this account`,- description: $localize`Hide any content from that user from you, your platform and its users.`,- isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === false,- handler: ({ account }) => this.blockAccountByInstance(account)- },- {- label: $localize`Unmute this account`,- description: $localize`Show this user's content to the users of this platform again.`,- isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === true,- handler: ({ account }) => this.unblockAccountByInstance(account)- }- ])++ if (hasAccountBlocklistRight || hasManageRight) {+ let platformModerationActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = [+ { label: $localize`Platform account moderation`, isHeader: true }+ ]++ if (hasAccountBlocklistRight) {+ platformModerationActions = platformModerationActions.concat([+ {+ label: $localize`Mute this account`,+ description: $localize`Hide any content from that user from you, your platform and its users.`,+ isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === false,+ handler: ({ account }) => this.blockAccountByInstance(account)+ },+ {+ label: $localize`Unmute this account`,+ description: $localize`Show this user's content to the users of this platform again.`,+ isDisplayed: ({ account }) => !this.isMyAccount(account) && account.mutedByInstance === true,+ handler: ({ account }) => this.unblockAccountByInstance(account)+ }+ ])+ }++ if (hasManageRight) {+ platformModerationActions = platformModerationActions.concat([+ {+ label: $localize`Ban`,+ description: $localize`User won't be able to login anymore, but videos and comments will be kept as is.`,+ handler: ({ user }) => this.openBanUserModal(user),+ isDisplayed: ({ user }) => !this.isMyUser(user) && !user.blocked+ },+ {+ label: $localize`Unban user`,+ description: $localize`Allow the user to login and create videos/comments again`,+ handler: ({ user }) => this.unbanUser(user),+ isDisplayed: ({ user }) => !this.isMyUser(user) && user.blocked+ }+ ])+ }++ instanceActions.push(platformModerationActions)}// Instance actions on server blocklists- if (accountValue && displayOptions.instanceAccount && authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)) {- instanceActions = instanceActions.concat([+ if (hasServerBlocklistRight) {+ instanceActions.push([+ { label: $localize`Platform server moderation`, isHeader: true },+{label: $localize`Mute the platform`,description: $localize`Hide any content from that platform from you, your platform and its users.`,@@ -430,19 +449,34 @@ export class UserModerationDropdownComponent implements OnInit, OnChanges {])}- if (accountValue && displayOptions.instanceAccount && authUser.hasRight(UserRight.MANAGE_ANY_VIDEO_COMMENT)) {- instanceActions = instanceActions.concat([- {- label: $localize`Remove comments from your platform`,- description: $localize`Remove comments made by this account from your platform.`,- isDisplayed: ({ account }) => !this.isMyAccount(account),- handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'instance' })- }- ])- }+ if (hasBulkRemoveCommentsRight || hasManageRight) {+ const dangerActions: DropdownAction<{ user: User, account: AccountMutedStatus }>[] = [+ { label: $localize`Platform danger zone`, isHeader: true }+ ]++ if (hasBulkRemoveCommentsRight) {+ dangerActions.push(+ {+ label: $localize`Remove comments from your platform`,+ description: $localize`Remove comments made by this account from your platform.`,+ isDisplayed: ({ account }) => !this.isMyAccount(account),+ handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'instance' })+ }+ )+ }- if (instanceActions.length === 0) return []+ if (hasManageRight) {+ dangerActions.push({+ label: $localize`Delete user`,+ description: $localize`Videos will be deleted, comments will be tombstoned.`,+ isDisplayed: ({ user }) => !this.isMyUser(user),+ handler: ({ user }) => this.removeUser(user)+ })+ }++ instanceActions.push(dangerActions)+ }- return [ { label: $localize`Platform moderation`, isHeader: true }, ...instanceActions ]+ return instanceActions}}