mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 11:52:25 +00:00
Prevent zap popover for logged-out viewers
This commit is contained in:
1 parent
ed1166c16e
commit
24cedbd5ac
3 files changed
+76
-8
No files matched your search
@@ -128,9 +128,14 @@ export class VideoModal {
|
||||
this.eventTarget.removeEventListener(type, listener, options);
|
||||
}
|
||||
|
||||
dispatch(type, detail) {
|
||||
const event = new CustomEvent(type, { detail });
|
||||
this.eventTarget.dispatchEvent(event);
|
||||
dispatch(type, detail, options = {}) {
|
||||
const config =
|
||||
options && typeof options === "object" ? { ...options } : Object.create(null);
|
||||
const event = new CustomEvent(type, {
|
||||
detail,
|
||||
cancelable: Boolean(config.cancelable),
|
||||
});
|
||||
return this.eventTarget.dispatchEvent(event);
|
||||
}
|
||||
|
||||
getRoot() {
|
||||
@@ -420,10 +425,14 @@ export class VideoModal {
|
||||
}
|
||||
|
||||
if (this.modalZapRequiresLogin) {
|
||||
this.dispatch("zap:open", {
|
||||
video: this.activeVideo,
|
||||
requiresLogin: true,
|
||||
});
|
||||
this.dispatch(
|
||||
"zap:open",
|
||||
{
|
||||
video: this.activeVideo,
|
||||
requiresLogin: true,
|
||||
},
|
||||
{ cancelable: false },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -446,9 +455,17 @@ export class VideoModal {
|
||||
return;
|
||||
}
|
||||
|
||||
const allowed = this.dispatch(
|
||||
"zap:open",
|
||||
{ video: this.activeVideo },
|
||||
{ cancelable: true },
|
||||
);
|
||||
if (allowed === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.modalZapPendingToggle = null;
|
||||
this.openZapDialog();
|
||||
this.dispatch("zap:open", { video: this.activeVideo });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user