From 7a29a0b8078625c1994f8d23c64a6e3c46fbd8b7 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 18 Jan 2026 13:38:34 -0500 Subject: [PATCH] Consolidate tag preference filtering stage --- js/app.js | 14 +++++++++----- js/feedEngine/stages.js | 15 --------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/js/app.js b/js/app.js index 2c1164a2..c6fb9acb 100644 --- a/js/app.js +++ b/js/app.js @@ -39,6 +39,7 @@ import { createDedupeByRootStage, createModerationStage, createResolvePostedAtStage, + createTagPreferenceFilterStage, createChronologicalSorter, createSubscriptionAuthorsSource, registerWatchHistoryFeed, @@ -5273,9 +5274,10 @@ class Application { return this.feedEngine.registerFeed("recent", { source: createActiveNostrSource({ service: this.nostrService }), stages: [ - // TODO(tag-preferences): introduce a dedicated stage here to filter by - // viewer interests/disinterests once the runtime metadata is wired up - // to filtering helpers. + // TODO(tag-preferences): keep tag-preference filtering consolidated in + // createTagPreferenceFilterStage so each feed has a single source of + // truth when interest-based inclusion/ranking lands. + createTagPreferenceFilterStage(), createBlacklistFilterStage({ shouldIncludeVideo: (video, options) => this.nostrService.shouldIncludeVideo(video, options), @@ -5345,8 +5347,10 @@ class Application { return this.feedEngine.registerFeed("subscriptions", { source: createSubscriptionAuthorsSource({ service: this.nostrService }), stages: [ - // TODO(tag-preferences): introduce preference-aware filtering ahead of - // the blacklist stage when tag-based ranking lands. + // TODO(tag-preferences): keep tag-preference filtering consolidated in + // createTagPreferenceFilterStage so each feed has a single source of + // truth when interest-based inclusion/ranking lands. + createTagPreferenceFilterStage(), createBlacklistFilterStage({ shouldIncludeVideo: (video, options) => this.nostrService.shouldIncludeVideo(video, options), diff --git a/js/feedEngine/stages.js b/js/feedEngine/stages.js index a4b583c3..cbe4fd32 100644 --- a/js/feedEngine/stages.js +++ b/js/feedEngine/stages.js @@ -328,10 +328,6 @@ export function createBlacklistFilterStage({ const options = { blacklistedEventIds: blacklist, isAuthorBlocked }; - const tagPreferences = context?.runtime?.tagPreferences; - const disinterests = normalizeTagSet(tagPreferences?.disinterests); - const hasTagPreferences = disinterests.size > 0; - const results = []; for (const item of items) { @@ -341,17 +337,6 @@ export function createBlacklistFilterStage({ continue; } - if (hasTagPreferences && hasDisinterestedTag(video, disinterests)) { - context?.addWhy?.({ - stage: stageName, - type: "filter", - reason: "disinterested-tag", - videoId: typeof video.id === "string" ? video.id : null, - pubkey: typeof video.pubkey === "string" ? video.pubkey : null, - }); - continue; - } - let include = false; try { include = includeFn(video, options) !== false;