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
This commit is contained in:
parent
ff4d2c73fd
commit
884b17773d
|
@ -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>
|
||||
|
|
|
@ -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…
Reference in New Issue