diff --git a/__tests__/feeds.ts b/__tests__/feeds.ts index 7470bdc3c..6fd267516 100644 --- a/__tests__/feeds.ts +++ b/__tests__/feeds.ts @@ -4292,6 +4292,24 @@ describe('query customFeed', () => { }, }, ]); + await con.getRepository(ContentPreferenceUser).save([ + { + feedId: 'cf1', + referenceUserId: '2', + referenceId: '2', + status: ContentPreferenceStatus.Follow, + userId: '1', + }, + ]); + await con.getRepository(ContentPreferenceSource).save([ + { + feedId: 'cf1', + sourceId: 'a', + referenceId: 'a', + status: ContentPreferenceStatus.Follow, + userId: '1', + }, + ]); await con.getRepository(ContentPreferenceKeyword).save([ { feedId: 'cf1', @@ -4438,6 +4456,8 @@ describe('query customFeed', () => { total_pages: 1, fresh_page_size: '4', allowed_tags: ['webdev', 'html', 'data'], + allowed_sources: ['a'], + allowed_author_ids: ['2'], feed_config_name: FeedConfigName.CustomFeedV1, disable_engagement_filter: false, }) diff --git a/src/integrations/feed/configs.ts b/src/integrations/feed/configs.ts index 80f28d699..c338d8875 100644 --- a/src/integrations/feed/configs.ts +++ b/src/integrations/feed/configs.ts @@ -15,7 +15,9 @@ import { Context } from '../../Context'; export type Options = { includeAllowedTags?: boolean; includeBlockedTags?: boolean; + includeAllowedSources?: boolean; includeBlockedSources?: boolean; + includeAllowedUsers?: boolean; includeSourceMemberships?: boolean; includePostTypes?: boolean; includeContentCuration?: boolean; @@ -115,8 +117,11 @@ const addFiltersToConfig = ({ if (filters.followingSources?.length && opts.includeFollowedSources) { baseConfig.followed_sources = filters.followingSources; } - if (filters.followingUsers?.length && opts.includeFollowedUsers) { - baseConfig.followed_user_ids = filters.followingUsers; + if (filters.followingSources?.length && opts.includeAllowedSources) { + baseConfig.allowed_sources = filters.followingSources; + } + if (filters.followingUsers?.length && opts.includeAllowedUsers) { + baseConfig.allowed_author_ids = filters.followingUsers; } return baseConfig; diff --git a/src/integrations/feed/types.ts b/src/integrations/feed/types.ts index 0a1f2f889..be9bcdcc4 100644 --- a/src/integrations/feed/types.ts +++ b/src/integrations/feed/types.ts @@ -48,10 +48,12 @@ export type FeedConfig = { fresh_page_size?: string; allowed_tags?: string[]; blocked_tags?: string[]; + allowed_sources?: string[]; blocked_sources?: string[]; allowed_post_types?: string[]; allowed_content_curations?: string[]; blocked_title_words?: string[]; + allowed_author_ids?: string[]; followed_user_ids?: string[]; followed_sources?: string[]; squad_ids?: string[]; diff --git a/src/schema/feeds.ts b/src/schema/feeds.ts index 13eb97728..6f3da6f79 100644 --- a/src/schema/feeds.ts +++ b/src/schema/feeds.ts @@ -1517,6 +1517,8 @@ export const resolvers: IResolvers = traceResolvers< includeBlockedTags: true, includeContentCuration: true, includeBlockedWords: true, + includeAllowedUsers: true, + includeAllowedSources: true, feedId: feedId, }, ),