mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 16:32:28 +00:00
Fix admin cache hydration timing and video moderation handler
This commit is contained in:
1 parent
1aa9eec6d1
commit
2daffd0354
2 files changed
+23
-1
No files matched your search
+18
-1
@@ -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() {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user