diff --git a/src/state/queries/search-posts.ts b/src/state/queries/search-posts.ts index b3bc721063..8a8a3fa52f 100644 --- a/src/state/queries/search-posts.ts +++ b/src/state/queries/search-posts.ts @@ -41,9 +41,10 @@ export function useSearchPostsQuery({ const moderationOpts = useModerationOpts() const selectArgs = React.useMemo( () => ({ + isSearchingSpecificUser: /from:(\w+)/.test(query), moderationOpts, }), - [moderationOpts], + [query, moderationOpts], ) const lastRun = React.useRef<{ data: InfiniteData @@ -73,7 +74,16 @@ export function useSearchPostsQuery({ enabled: enabled ?? !!moderationOpts, select: React.useCallback( (data: InfiniteData) => { - const {moderationOpts} = selectArgs + const {moderationOpts, isSearchingSpecificUser} = selectArgs + + /* + * If a user applies the `from:` filter, don't apply any + * moderation. Note that if we add any more filtering logic below, we + * may need to adjust this. + */ + if (isSearchingSpecificUser) { + return data + } // Keep track of the last run and whether we can reuse // some already selected pages from there.