mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Merge pull request #1328 from PR0M3TH3AN/codex/refactor-disinterest-filtering-in-feed-stages
Consolidate tag-preference filtering in feed stages
This commit is contained in:
2 files changed
+9
-20
No files matched your search
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user