Merge pull request #1830 from PR0M3TH3AN/fix-admin-list-store-and-tests-13859044373319122127

fix(admin): exclude whitelisted users from blacklist and fix unit tests
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-27 13:14:16 -05:00
commit cd7ab69766
2 files changed
+10 -1

No files matched your search

+1
View File
@@ -202,6 +202,7 @@ function sanitizeAdminState(state = {}) {
normalizeNpub(ADMIN_SUPER_NPUB),
...ADMIN_EDITORS_NPUBS.map(normalizeNpub),
...sanitizedEditors.map(normalizeNpub),
...sanitizedWhitelist.map(normalizeNpub),
]);
const sanitizedBlacklist = sanitizeNpubList(state.blacklist || []).filter(
+9 -1
View File
@@ -272,6 +272,14 @@ nostrClient.pool = {
throw new Error("list failure for authors");
}
if (listFailureMode === "throw-community") {
const fullSourceTag = `${ADMIN_LIST_NAMESPACE}:${ADMIN_COMMUNITY_BLACKLIST_SOURCES}`;
const fullPrefix = `${ADMIN_LIST_NAMESPACE}:${ADMIN_COMMUNITY_BLACKLIST_PREFIX}`;
if (dTag === fullSourceTag || dTag.startsWith(fullPrefix)) {
throw new Error("list failure for community");
}
}
const key = `${authorKey}::${dTag}`;
const fallbackKey = `*::${dTag}`;
const event = listEventRegistry.get(key) || listEventRegistry.get(fallbackKey);
@@ -451,7 +459,7 @@ assert.deepEqual(
setListFailureMode(null);
resetListRegistry();
setListFailureMode("throw-authors");
setListFailureMode("throw-community");
registerListEvent({
dTag: editorsDTag,