Remove legacy view filter flag

This commit is contained in:
thePR0M3TH3AN committed 2026-01-06 15:36:37 -05:00
1 parent 860c12cc94
commit bc8bfd1ed5
3 files changed
+5 -69

No files matched your search

+5 -22
View File
@@ -10,10 +10,6 @@ const {
createVideoViewEventFilters,
getViewEventGuardWindowMs,
} = await import("../js/nostr/viewEvents.js");
const {
setViewFilterIncludeLegacyVideo,
resetRuntimeFlags,
} = await import("../js/constants.js");
async function withMockedNow(initialMs, callback) {
const originalNow = Date.now;
@@ -94,28 +90,15 @@ async function testCreateVideoViewEventFiltersForAddressPointer() {
assertPointerFilterStructure(filters[0], pointerValue, "primary");
}
async function testCreateVideoViewEventFiltersIncludeLegacyWhenEnabled() {
async function testCreateVideoViewEventFiltersForEventPointer() {
const pointerValue = "legacy-event";
resetRuntimeFlags();
setViewFilterIncludeLegacyVideo(true);
try {
const { filters } = createVideoViewEventFilters({ type: "e", value: pointerValue });
assert.ok(Array.isArray(filters) && filters.length === 2, "legacy flag should add a secondary filter");
assertPointerFilterStructure(filters[0], pointerValue, "primary");
const legacyFilter = filters[1];
assert.ok(legacyFilter, "legacy filter should exist when flag enabled");
assert.deepEqual(
legacyFilter["#video"],
[pointerValue],
"legacy filter should match the pointer value via #video tag",
);
} finally {
resetRuntimeFlags();
}
const { filters } = createVideoViewEventFilters({ type: "e", value: pointerValue });
assert.ok(Array.isArray(filters) && filters.length === 1, "filters should include only the pointer filter");
assertPointerFilterStructure(filters[0], pointerValue, "primary");
}
await testRememberViewPublishHonorsGuardWindow();
await testCreateVideoViewEventFiltersForAddressPointer();
await testCreateVideoViewEventFiltersIncludeLegacyWhenEnabled();
await testCreateVideoViewEventFiltersForEventPointer();
console.log("nostr view events tests passed");