mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-01 18:32:27 +00:00
Fix: Enable video modal share button when source is available
The share button in the video modal was not being enabled correctly because `updateSourceAvailability` returned early if `sourceToggleContainer` was missing, skipping the `setShareEnabled` call. This change ensures `setShareEnabled` is called based on `hasUrl` or `hasMagnet` before checking for `sourceToggleContainer`. Added a regression test `tests/e2e/video-modal-share-bug.spec.ts`.
This commit is contained in:
1 parent
ba69eb6163
commit
afa231da3e
2 files changed
+73
-4
No files matched your search
@@ -2797,10 +2797,6 @@ export class VideoModal {
|
||||
}
|
||||
|
||||
updateSourceAvailability(video) {
|
||||
if (!this.sourceToggleContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const hasUrl = Boolean(
|
||||
typeof video?.url === "string" && video.url.trim()
|
||||
);
|
||||
@@ -2809,6 +2805,12 @@ export class VideoModal {
|
||||
video?.torrentSupported
|
||||
);
|
||||
|
||||
this.setShareEnabled(hasUrl || hasMagnet);
|
||||
|
||||
if (!this.sourceToggleContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasUrl || hasMagnet) {
|
||||
this.sourceToggleContainer.removeAttribute("hidden");
|
||||
this.sourceToggleContainer.classList.remove("hidden");
|
||||
|
||||
Reference in new issue
Block a user