Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix updating P2P setting

Chocobozzzb63c607b92fd
diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html
index 6024c7894a..d4b2b33308 100644
--- a/client/src/app/menu/menu.component.html
+++ b/client/src/app/menu/menu.component.html
@@ -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>
diff --git a/client/src/app/shared/shared-forms/input-switch.component.html b/client/src/app/shared/shared-forms/input-switch.component.html
index 4017d4aa5f..2def02a057 100644
--- a/client/src/app/shared/shared-forms/input-switch.component.html
+++ b/client/src/app/shared/shared-forms/input-switch.component.html
@@ -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>
diff --git a/client/src/app/shared/shared-forms/input-switch.component.ts b/client/src/app/shared/shared-forms/input-switch.component.ts
index abb96de624..e019029c54 100644
--- a/client/src/app/shared/shared-forms/input-switch.component.ts
+++ b/client/src/app/shared/shared-forms/input-switch.component.ts
@@ -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 */ }