mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 22:02:54 +00:00
Merge pull request #2725 from PR0M3TH3AN/refactor-delete-modal-dtag-919037621417068012
Refactor DeleteModal to use shared getDTagValueFromTags utility
This commit is contained in:
2 files changed
+72
-16
No files matched your search
@@ -1,20 +1,6 @@
|
||||
import { getDTagValueFromTags } from "../../nostr/index.js";
|
||||
import { createModalAccessibility } from "./modalAccessibility.js";
|
||||
|
||||
function extractDTagValue(tags) {
|
||||
if (!Array.isArray(tags)) {
|
||||
return "";
|
||||
}
|
||||
for (const entry of tags) {
|
||||
if (!Array.isArray(entry) || entry.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if (entry[0] === "d" && typeof entry[1] === "string") {
|
||||
return entry[1];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
export class DeleteModal {
|
||||
constructor({
|
||||
removeTrackingScripts,
|
||||
@@ -232,7 +218,7 @@ export class DeleteModal {
|
||||
video && typeof video.videoRootId === "string" && video.videoRootId.trim().length
|
||||
? video.videoRootId.trim()
|
||||
: "";
|
||||
const dTagValue = extractDTagValue(video?.tags);
|
||||
const dTagValue = getDTagValueFromTags(video?.tags);
|
||||
|
||||
if (this.subtitle) {
|
||||
const subtitleParts = [];
|
||||
|
||||
Reference in new issue
Block a user