mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-31 09:52:24 +00:00
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:
2 files changed
+10
-1
No files matched your search
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user