mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 08:52:25 +00:00
Merge pull request #1032 from PR0M3TH3AN/codex/fix-comment-display-in-video-player-modal
Normalize comment tree root keys before rendering
This commit is contained in:
2 files changed
+23
-2
No files matched your search
@@ -1815,7 +1815,12 @@ export class VideoModal {
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const trimmed = value.trim();
|
||||
if (!trimmed || trimmed === "null" || trimmed === "undefined") {
|
||||
if (
|
||||
!trimmed ||
|
||||
trimmed === "null" ||
|
||||
trimmed === "undefined" ||
|
||||
trimmed === "__root__"
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
return trimmed;
|
||||
|
||||
@@ -458,8 +458,24 @@ export default class VideoModalCommentController {
|
||||
input instanceof Map ? input : this.createMapFromInput(input);
|
||||
const result = new Map();
|
||||
source.forEach((value, key) => {
|
||||
let normalizedKey = key;
|
||||
if (normalizedKey === null || normalizedKey === undefined) {
|
||||
normalizedKey = null;
|
||||
} else if (typeof normalizedKey === "string") {
|
||||
const trimmed = normalizedKey.trim();
|
||||
if (
|
||||
!trimmed ||
|
||||
trimmed === "null" ||
|
||||
trimmed === "undefined" ||
|
||||
trimmed === "__root__"
|
||||
) {
|
||||
normalizedKey = null;
|
||||
} else {
|
||||
normalizedKey = trimmed;
|
||||
}
|
||||
}
|
||||
const list = Array.isArray(value) ? value.filter(Boolean) : [];
|
||||
result.set(key, list);
|
||||
result.set(normalizedKey, list);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user