1
0
Fork 0

Fix updating P2P setting

This commit is contained in:
Chocobozzz 2023-07-21 11:07:49 +02:00
parent 305facdfab
commit b63c607b92
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 4 additions and 3 deletions

View file

@ -57,11 +57,11 @@
<span class="ms-auto muted">{{ nsfwPolicy }}</span>
</a>
<button class="dropdown-item" (click)="toggleUseP2P()" (mousedown)="$event.stopPropagation()" ngbDropdownItem>
<button class="dropdown-item" (mousedown)="$event.stopPropagation(); toggleUseP2P()" ngbDropdownItem>
<my-global-icon iconName="p2p" aria-hidden="true"></my-global-icon>
<ng-container i18n>Help share videos</ng-container>
<my-input-switch inputName="p2p-enabled" class="ms-auto" [checked]="user.p2pEnabled"></my-input-switch>
<my-input-switch inputName="p2p-enabled" class="ms-auto" [preventUpdate]="true" [checked]="user.p2pEnabled"></my-input-switch>
</button>
<div class="dropdown-divider"></div>

View file

@ -1,2 +1,2 @@
<input type="checkbox" [checked]="checked" [name]="inputName" [id]="inputName" (change)="update()" />
<input type="checkbox" [checked]="checked" [name]="inputName" [id]="inputName" (change)="update()" [disabled]="preventUpdate" />
<label [for]="inputName" class="ms-auto">Toggle</label>

View file

@ -16,6 +16,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
export class InputSwitchComponent implements ControlValueAccessor {
@Input() checked = false
@Input() inputName: string
@Input() preventUpdate = false
propagateChange = (_: any) => { /* empty */ }