ActivityPub-federated video streaming platform using P2P directly in your web browser
Add ability to mute user when banning them
Poslovitch5a8de57d5740
diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.html b/client/src/app/shared/shared-moderation/user-ban-modal.component.htmlindex b41ae230d2..6c83cc9cc1 100644--- a/client/src/app/shared/shared-moderation/user-ban-modal.component.html+++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.html@@ -21,6 +21,13 @@A banned user will no longer be able to login.</div>+ <div class="form-group">+ <my-peertube-checkbox+ inputName="banMute" formControlName="mute"+ i18n-labelText labelText="Mute this account"+ ></my-peertube-checkbox>+ </div>+<div class="form-group inputs"><inputtype="button" role="button" i18n-value value="Cancel" class="peertube-button grey-button"diff --git a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts b/client/src/app/shared/shared-moderation/user-ban-modal.component.tsindex 17cad18ec0..b3f03990f6 100644--- a/client/src/app/shared/shared-moderation/user-ban-modal.component.ts+++ b/client/src/app/shared/shared-moderation/user-ban-modal.component.ts@@ -5,7 +5,9 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'import { User } from '@shared/models'import { USER_BAN_REASON_VALIDATOR } from '../form-validators/user-validators'+import { Account } from '../shared-main'import { UserAdminService } from '../shared-users'+import { BlocklistService } from './blocklist.service'@Component({selector: 'my-user-ban-modal',@@ -24,14 +26,16 @@ export class UserBanModalComponent extends FormReactive implements OnInit {protected formValidatorService: FormValidatorService,private modalService: NgbModal,private notifier: Notifier,- private userAdminService: UserAdminService+ private userAdminService: UserAdminService,+ private blocklistService: BlocklistService) {super()}ngOnInit () {this.buildForm({- reason: USER_BAN_REASON_VALIDATOR+ reason: USER_BAN_REASON_VALIDATOR,+ mute: null})}@@ -50,6 +54,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit {banUser () {const reason = this.form.value['reason'] || undefined+ const mute = this.form.value['mute']this.userAdminService.banUsers(this.usersToBan, reason).subscribe({@@ -61,6 +66,23 @@ export class UserBanModalComponent extends FormReactive implements OnInit {this.notifier.success(message)this.userBanned.emit(this.usersToBan)++ if (mute) {+ const users = Array.isArray(this.usersToBan) ? this.usersToBan : [ this.usersToBan ]+ users.forEach(user => {+ const account = new Account(user.account)+ this.blocklistService.blockAccountByInstance(account)+ .subscribe({+ next: () => {+ this.notifier.success($localize`Account ${user.username} muted by the instance.`)+ account.mutedByInstance = true+ },++ error: err => this.notifier.error(err.message)+ })+ })+ }+this.hide()},