From 2daffd0354c0d2bf61059c4c3375eebf962b3a85 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sat, 25 Oct 2025 17:46:57 -0400 Subject: [PATCH] Fix admin cache hydration timing and video moderation handler --- js/accessControl.js | 19 ++++++++++++++++++- js/ui/views/VideoListView.js | 5 +++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/js/accessControl.js b/js/accessControl.js index bae6e578..c3474257 100644 --- a/js/accessControl.js +++ b/js/accessControl.js @@ -83,7 +83,24 @@ class AccessControl { this._whitelistListeners = new Set(); this._editorListeners = new Set(); - this._hydrateFromCache(); + this._scheduleHydrateFromCache(); + } + + _scheduleHydrateFromCache() { + const runHydrate = () => { + try { + this._hydrateFromCache(); + } catch (error) { + userLogger.error("accessControl failed to hydrate from cache", error); + } + }; + + if (typeof queueMicrotask === "function") { + queueMicrotask(runHydrate); + return; + } + + Promise.resolve().then(runHydrate); } _hydrateFromCache() { diff --git a/js/ui/views/VideoListView.js b/js/ui/views/VideoListView.js index 333018f1..3a682874 100644 --- a/js/ui/views/VideoListView.js +++ b/js/ui/views/VideoListView.js @@ -189,6 +189,7 @@ export class VideoListView { delete: null, blacklist: null, moderationOverride: null, + moderationHide: null, tagActivate: null, }; @@ -298,6 +299,10 @@ export class VideoListView { this.handlers.moderationOverride = typeof handler === "function" ? handler : null; } + setModerationHideHandler(handler) { + this.handlers.moderationHide = typeof handler === "function" ? handler : null; + } + setTagActivationHandler(handler) { this.handlers.tagActivate = typeof handler === "function" ? handler : null; }