Browse Source

Fix user ban modal grammar to account for multiple users (#4722)

* Fix user ban modal grammar to account for multiple users

* Address variable sugggestion

* Address property syntax suggestion

* Address localization suggestion

* More concise `isSingleUser` declaration
pull/4724/head
The Cashew Trader GitHub 6 days ago
parent
commit
884b17773d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions
  1. +1
    -1
      client/src/app/shared/shared-moderation/user-ban-modal.component.html
  2. +4
    -0
      client/src/app/shared/shared-moderation/user-ban-modal.component.ts

+ 1
- 1
client/src/app/shared/shared-moderation/user-ban-modal.component.html View File

@@ -27,7 +27,7 @@
(click)="hide()" (key.enter)="hide()"
>

<input type="submit" i18n-value value="Ban this user" class="peertube-button orange-button" [disabled]="!form.valid" />
<input type="submit" i18n-value [value]="modalMessage" class="peertube-button orange-button" [disabled]="!form.valid" />
</div>
</form>
</div>


+ 4
- 0
client/src/app/shared/shared-moderation/user-ban-modal.component.ts View File

@@ -17,6 +17,7 @@ export class UserBanModalComponent extends FormReactive implements OnInit {

private usersToBan: User | User[]
private openedModal: NgbModalRef
modalMessage = ''

constructor (
protected formValidatorService: FormValidatorService,
@@ -36,6 +37,9 @@ export class UserBanModalComponent extends FormReactive implements OnInit {
openModal (user: User | User[]) {
this.usersToBan = user
this.openedModal = this.modalService.open(this.modal, { centered: true })

const isSingleUser = !(Array.isArray(this.usersToBan) && this.usersToBan.length > 1)
this.modalMessage = isSingleUser ? $localize`Ban this user` : $localize`Ban these users`
}

hide () {


Loading…
Cancel
Save