mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-12-04 23:10:25 -06:00
Allow uncurated hacks to be searchable (#129)
This commit is contained in:
@@ -3,7 +3,7 @@ import { createServiceClient } from "@/utils/supabase/server";
|
||||
import { sortOrderedTags, type OrderedTag, getCoverUrls } from "@/utils/format";
|
||||
import { fetchInChunks } from "@/utils/array";
|
||||
import type { Tables } from "@/types/db";
|
||||
import type { DiscoverData } from "@/types/discover";
|
||||
import type { DiscoverData, DiscoverHack } from "@/types/discover";
|
||||
import { resolveHackDisplayVersion } from "@/utils/patches/hack-display-version";
|
||||
import { AI_SELECT, aiDisclosureFromRow } from "@/utils/aiDisclosure";
|
||||
|
||||
@@ -45,10 +45,9 @@ async function generateDiscoverData(): Promise<DiscoverData> {
|
||||
const { data: rows, error: hacksError } = await supabase
|
||||
.from("hacks")
|
||||
.select(
|
||||
`slug,title,summary,base_rom,downloads,created_by,current_patch,custom_version_name,original_author,curated_at,is_archive,completion_status,${AI_SELECT}`,
|
||||
`slug,title,summary,base_rom,downloads,created_by,current_patch,custom_version_name,original_author,curated,curated_at,approved_at,is_archive,completion_status,${AI_SELECT}`,
|
||||
)
|
||||
.eq("approved", true)
|
||||
.eq("curated", true)
|
||||
.eq("is_archive", false)
|
||||
.is("deleted_at", null);
|
||||
if (hacksError) throw hacksError;
|
||||
@@ -216,7 +215,9 @@ async function generateDiscoverData(): Promise<DiscoverData> {
|
||||
]),
|
||||
);
|
||||
|
||||
const hacks = rows.map((row) => {
|
||||
const hacks: DiscoverHack[] = [];
|
||||
const searchOnly: DiscoverHack[] = [];
|
||||
for (const row of rows) {
|
||||
const currentPatch = row.current_patch
|
||||
? patchesById.get(row.current_patch)
|
||||
: undefined;
|
||||
@@ -224,7 +225,7 @@ async function generateDiscoverData(): Promise<DiscoverData> {
|
||||
const downloads = row.downloads ?? 0;
|
||||
const recentDownloads = recentDownloadsBySlug.get(row.slug) ?? 0;
|
||||
|
||||
return {
|
||||
(row.curated ? hacks : searchOnly).push({
|
||||
slug: row.slug,
|
||||
title: row.title,
|
||||
author: row.original_author || usernameById.get(row.created_by) || "Unknown",
|
||||
@@ -243,14 +244,17 @@ async function generateDiscoverData(): Promise<DiscoverData> {
|
||||
is_archive: false,
|
||||
completion_status: row.completion_status,
|
||||
curatedAt: row.curated_at,
|
||||
// approved_at holds UTC but has no time zone, which Date.parse would read as local time.
|
||||
approvedAt: row.approved_at && `${row.approved_at}Z`,
|
||||
publishedAt: currentPatch?.published_at ?? null,
|
||||
trendingScore: recentDownloads + 8 * Math.log(downloads + 1),
|
||||
ai: aiDisclosureFromRow(row)?.levels ?? null,
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
hacks,
|
||||
searchOnly,
|
||||
generatedAt,
|
||||
tagGroups,
|
||||
ungroupedTags,
|
||||
@@ -260,7 +264,7 @@ async function generateDiscoverData(): Promise<DiscoverData> {
|
||||
const getCachedDiscoverData = cache(
|
||||
generateDiscoverData,
|
||||
// Bump the version when DiscoverHack's shape changes, so a deploy never reads the old shape.
|
||||
["discover-data", "v3"],
|
||||
["discover-data", "v4"],
|
||||
{
|
||||
revalidate: DISCOVER_REVALIDATE_SECONDS,
|
||||
tags: ["discover"],
|
||||
|
||||
@@ -14,7 +14,7 @@ export const metadata: Metadata = {
|
||||
};
|
||||
|
||||
export default async function DiscoverPage() {
|
||||
const { hacks, generatedAt, tagGroups, ungroupedTags } = await getDiscoverData();
|
||||
const { hacks, searchOnly, generatedAt, tagGroups, ungroupedTags } = await getDiscoverData();
|
||||
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-[1164px] px-6 pt-4 md:pt-6">
|
||||
@@ -26,6 +26,7 @@ export default async function DiscoverPage() {
|
||||
</div>
|
||||
<DiscoverBrowser
|
||||
catalog={hacks}
|
||||
searchOnly={searchOnly}
|
||||
generatedAt={generatedAt}
|
||||
initialState={DISCOVER_DEFAULT_STATE}
|
||||
tagGroups={tagGroups}
|
||||
|
||||
@@ -38,6 +38,13 @@ Use the [Discover page](/discover) to search for hacks or filter by tags, base R
|
||||
|
||||
Download activity is the only input to popularity and trending rankings. Placement does not represent a staff recommendation.
|
||||
|
||||
### What does curated mean? {#curation}
|
||||
Hackdex staff choose which hacks go into the curated collection, which the Discover page and the homepage list by default. We pick hacks that show passion for creative work and a commitment to making a quality experience. We want the curated collection to encourage creativity in others, not push toward vibecoding.
|
||||
|
||||
A hack needs a completed AI disclosure label before staff can curate it.
|
||||
|
||||
Published hacks outside the curated collection keep their public page. You can still find them on Discover by searching for the title or the creator's username. Those matches show up in a separate group after curated results.
|
||||
|
||||
### Does Hackdex allow AI-generated content?
|
||||
Yes, with disclosure. Creators must disclose AI use in both content and code through Hackdex's AI disclosure form. Their disclosure appears on the hack's page to help you decide whether you want to play it. On Discover, you can filter to hacks with no AI content or no direct AI usage.
|
||||
|
||||
@@ -112,7 +119,7 @@ Both formats support checksum verification so the patch is linked to the correct
|
||||
### How does my hack gain visibility?
|
||||
We highly recommend linking to your romhack's Hackdex page from PokéCommunity, Reddit, or other social media platforms. Doing so can help boost your hack's visibility and outrank those sketchy ROM sharing sites that steal many creators' hard work.
|
||||
|
||||
Once approved, your hack gets a public page. Staff choose which approved hacks appear on Discover and the homepage, and those listings are ordered automatically. "Newest" sorts by the date a hack was curated, and "Recently updated" sorts by the publication date of your current patch. "Most popular" and "Trending" use download activity.
|
||||
Once approved, your hack gets a public page. Staff choose which approved hacks join the curated collection, which Discover and the homepage list by default. Hackdex orders those listings automatically. "Newest" sorts by the date a hack was curated, and "Recently updated" sorts by the publication date of your current patch. "Most popular" and "Trending" use download activity. If your hack isn't in the curated collection, players can still find it on Discover by searching for its title or your username. Those matches show up in a separate group after curated results.
|
||||
|
||||
Here are some helpful tips for improving your hack's page to help increase visibility:
|
||||
- Include at least 3 screenshots that help make your hack stand out, with the first one being the most eye-catching.
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
} from "./DiscoverFilters";
|
||||
import { baseGameLabel, baseRoms } from "@/data/baseRoms";
|
||||
import { aiFilterActive, aiFilterLabel, aiPresetOf, matchesAiFilter, NO_AI_FILTER, type AiFilter } from "@/utils/aiDisclosure";
|
||||
import { matchesHackName } from "@/utils/hackNameSearch";
|
||||
|
||||
const SORT_OPTIONS: SelectOption[] = [
|
||||
{ value: "trending", label: "Trending", icon: MdWhatshot },
|
||||
@@ -48,7 +49,10 @@ const VIEW_KEY = "hackdex-discover-view";
|
||||
type View = "grid" | "list";
|
||||
|
||||
interface DiscoverBrowserProps {
|
||||
/** Curated hacks, which Discover lists and browses. */
|
||||
catalog: DiscoverHack[];
|
||||
/** Uncurated hacks, which show up only in their own group when a search looks one up by name. */
|
||||
searchOnly: DiscoverHack[];
|
||||
generatedAt: string;
|
||||
initialState: DiscoverUrlState;
|
||||
tagGroups: Record<string, string[]>;
|
||||
@@ -56,26 +60,50 @@ interface DiscoverBrowserProps {
|
||||
}
|
||||
|
||||
/**
|
||||
* One predicate for the results and the phone sheet's "Show N hacks", so they can't disagree.
|
||||
* One set of predicates for the results and the phone sheet's "Show N hacks", so they can't disagree.
|
||||
* Curated hacks match the query anywhere; search-only hacks need a name lookup. Both take every filter.
|
||||
* Tags are OR within a category and AND across them; "Complete" also matches hacks without a status.
|
||||
*/
|
||||
function hackMatcher(f: FilterState, query: string, groups: TagGroup[], readyBaseRomIds: Set<string>) {
|
||||
const q = query.toLowerCase();
|
||||
const wanted = groups.map((g) => g.tags.filter((t) => f.tags.includes(t))).filter((picked) => picked.length > 0);
|
||||
return (h: DiscoverHack) =>
|
||||
(!q ||
|
||||
h.title.toLowerCase().includes(q) ||
|
||||
h.author.toLowerCase().includes(q) ||
|
||||
!!h.summary?.toLowerCase().includes(q) ||
|
||||
h.tags.some((t) => t.name.toLowerCase().includes(q))) &&
|
||||
const passesFilters = (h: DiscoverHack) =>
|
||||
wanted.every((picked) => picked.some((t) => h.tags.some((tag) => tag.name === t))) &&
|
||||
(f.baseRoms.length === 0 || (!!h.baseRomId && f.baseRoms.includes(h.baseRomId))) &&
|
||||
(f.completionStatuses.length === 0 || f.completionStatuses.includes(h.completion_status ?? "Complete")) &&
|
||||
(!f.onlyReady || (!h.is_archive && !!h.baseRomId && readyBaseRomIds.has(h.baseRomId))) &&
|
||||
matchesAiFilter(h.ai, f.ai);
|
||||
return {
|
||||
curated: (h: DiscoverHack) =>
|
||||
(!q ||
|
||||
h.title.toLowerCase().includes(q) ||
|
||||
h.author.toLowerCase().includes(q) ||
|
||||
!!h.summary?.toLowerCase().includes(q) ||
|
||||
h.tags.some((t) => t.name.toLowerCase().includes(q))) &&
|
||||
passesFilters(h),
|
||||
searchOnly: (h: DiscoverHack) => matchesHackName(query, h) && passesFilters(h),
|
||||
};
|
||||
}
|
||||
|
||||
export default function DiscoverBrowser({ catalog, generatedAt, initialState, tagGroups, ungroupedTags }: DiscoverBrowserProps) {
|
||||
/** Newest first by curation date. Uncurated hacks have none, so they use their approval date. */
|
||||
const listedAt = (h: DiscoverHack) => Date.parse(h.curatedAt ?? h.approvedAt ?? "") || 0;
|
||||
|
||||
function compareHacks(sort: DiscoverSortOption) {
|
||||
return (a: DiscoverHack, b: DiscoverHack) => {
|
||||
if (sort === "popular") return b.downloads - a.downloads;
|
||||
if (sort === "new") return listedAt(b) - listedAt(a);
|
||||
if (sort === "updated") {
|
||||
if (!a.publishedAt && !b.publishedAt) return 0;
|
||||
if (!a.publishedAt) return 1;
|
||||
if (!b.publishedAt) return -1;
|
||||
return Date.parse(b.publishedAt) - Date.parse(a.publishedAt);
|
||||
}
|
||||
if (sort === "alpha") return a.title.localeCompare(b.title);
|
||||
return b.trendingScore - a.trendingScore;
|
||||
};
|
||||
}
|
||||
|
||||
export default function DiscoverBrowser({ catalog, searchOnly, generatedAt, initialState, tagGroups, ungroupedTags }: DiscoverBrowserProps) {
|
||||
const [query, setQuery] = React.useState(initialState.query);
|
||||
const [selectedTags, setSelectedTags] = React.useState<string[]>(() => [...initialState.tags]);
|
||||
const [selectedBaseRoms, setSelectedBaseRoms] = React.useState<string[]>(() => [...initialState.baseRoms]);
|
||||
@@ -160,21 +188,13 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
|
||||
syncUrl({ ...nextState, page: 1 }, "replace");
|
||||
}, [currentUrlState, initialUrlStateApplied, selectedTags.length, syncUrl, validTagNames]);
|
||||
|
||||
const filtered = React.useMemo(() => {
|
||||
// One list that pages as a whole: curated matches, then the search-only group from `curatedCount` on.
|
||||
const { filtered, curatedCount } = React.useMemo(() => {
|
||||
const matches = hackMatcher({ tags: selectedTags, baseRoms: selectedBaseRoms, completionStatuses: selectedCompletionStatuses, onlyReady, ai }, query, groups, readyBaseRomIds);
|
||||
return catalog.filter(matches).sort((a, b) => {
|
||||
if (sort === "popular") return b.downloads - a.downloads;
|
||||
if (sort === "new") return (b.curatedAt ? Date.parse(b.curatedAt) : 0) - (a.curatedAt ? Date.parse(a.curatedAt) : 0);
|
||||
if (sort === "updated") {
|
||||
if (!a.publishedAt && !b.publishedAt) return 0;
|
||||
if (!a.publishedAt) return 1;
|
||||
if (!b.publishedAt) return -1;
|
||||
return Date.parse(b.publishedAt) - Date.parse(a.publishedAt);
|
||||
}
|
||||
if (sort === "alpha") return a.title.localeCompare(b.title);
|
||||
return b.trendingScore - a.trendingScore;
|
||||
});
|
||||
}, [ai, catalog, groups, onlyReady, query, readyBaseRomIds, selectedBaseRoms, selectedCompletionStatuses, selectedTags, sort]);
|
||||
const compare = compareHacks(sort);
|
||||
const curated = catalog.filter(matches.curated).sort(compare);
|
||||
return { filtered: [...curated, ...searchOnly.filter(matches.searchOnly).sort(compare)], curatedCount: curated.length };
|
||||
}, [ai, catalog, groups, onlyReady, query, readyBaseRomIds, searchOnly, selectedBaseRoms, selectedCompletionStatuses, selectedTags, sort]);
|
||||
|
||||
const showSkeleton = !initialUrlStateApplied || !aiLoaded || (onlyReady && baseRomsLoading);
|
||||
const totalPages = Math.max(1, Math.ceil(filtered.length / HACKS_PER_PAGE));
|
||||
@@ -189,6 +209,9 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
|
||||
const startIndex = (currentPage - 1) * HACKS_PER_PAGE;
|
||||
const endIndex = Math.min(filtered.length, startIndex + HACKS_PER_PAGE);
|
||||
const paginated = React.useMemo(() => filtered.slice(startIndex, endIndex), [filtered, startIndex, endIndex]);
|
||||
const pageSplit = Math.min(Math.max(curatedCount - startIndex, 0), paginated.length);
|
||||
const pageCurated = paginated.slice(0, pageSplit);
|
||||
const pageSearchOnly = paginated.slice(pageSplit);
|
||||
|
||||
const scrollToResults = React.useCallback(() => {
|
||||
requestAnimationFrame(() => listRef.current?.scrollIntoView({ block: "start" }));
|
||||
@@ -253,10 +276,11 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
|
||||
const [sheet, setSheet] = React.useState(false);
|
||||
const [draft, setDraft] = React.useState<FilterState>(filterState);
|
||||
const filterBtnRef = React.useRef<HTMLButtonElement>(null);
|
||||
const draftTotal = React.useMemo(
|
||||
() => (sheet ? catalog.filter(hackMatcher(draft, query, groups, readyBaseRomIds)).length : 0),
|
||||
[catalog, draft, groups, query, readyBaseRomIds, sheet]
|
||||
);
|
||||
const draftTotal = React.useMemo(() => {
|
||||
if (!sheet) return 0;
|
||||
const matches = hackMatcher(draft, query, groups, readyBaseRomIds);
|
||||
return catalog.filter(matches.curated).length + searchOnly.filter(matches.searchOnly).length;
|
||||
}, [catalog, draft, groups, query, readyBaseRomIds, searchOnly, sheet]);
|
||||
|
||||
const openSheet = (focusAi = false) => {
|
||||
setDraft(filterState);
|
||||
@@ -361,6 +385,20 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
|
||||
</button>
|
||||
);
|
||||
const pager = totalPages > 1;
|
||||
const hackList = (hacks: DiscoverHack[], label: string) =>
|
||||
view === "grid" ? (
|
||||
<div className="mt-4 grid grid-cols-1 gap-3 md:mt-5 md:grid-cols-[repeat(auto-fill,minmax(264px,1fr))] md:gap-5" aria-label={label}>
|
||||
{hacks.map((hack) => (
|
||||
<HackCard key={hack.slug} hack={hack} fill />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-4 flex flex-col gap-2.5" aria-label={label}>
|
||||
{hacks.map((hack) => (
|
||||
<HackRow key={hack.slug} hack={hack} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="grid gap-8 md:grid-cols-[240px_minmax(0,1fr)]">
|
||||
@@ -545,18 +583,21 @@ export default function DiscoverBrowser({ catalog, generatedAt, initialState, ta
|
||||
</p>
|
||||
{pager && <Pagination current={currentPage} last={totalPages} onPage={changePage} compact />}
|
||||
</div>
|
||||
{view === "grid" ? (
|
||||
<div className="mt-4 grid grid-cols-1 gap-3 md:mt-5 md:grid-cols-[repeat(auto-fill,minmax(264px,1fr))] md:gap-5" aria-label="Hacks">
|
||||
{paginated.map((hack) => (
|
||||
<HackCard key={hack.slug} hack={hack} fill />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="mt-4 flex flex-col gap-2.5" aria-label="Hacks">
|
||||
{paginated.map((hack) => (
|
||||
<HackRow key={hack.slug} hack={hack} />
|
||||
))}
|
||||
</div>
|
||||
{pageCurated.length > 0 && hackList(pageCurated, "Hacks")}
|
||||
{pageSearchOnly.length > 0 && (
|
||||
// The rule only separates it from curated cards above; a page that opens with the group skips it.
|
||||
<section aria-labelledby="discover-search-only" className={pageCurated.length > 0 ? "mt-10 border-t border-line pt-5" : "mt-5"}>
|
||||
<h2 id="discover-search-only" className="text-[15px] font-semibold">
|
||||
Outside the curated collection
|
||||
</h2>
|
||||
<p className="mt-1 text-[13px] text-text-2">
|
||||
These hacks have public pages and show up here when you search by title or creator.{" "}
|
||||
<Link href="/faq#curation" prefetch={false} className="text-link-hd">
|
||||
What does curated mean?
|
||||
</Link>
|
||||
</p>
|
||||
{hackList(pageSearchOnly, "Hacks outside the curated collection")}
|
||||
</section>
|
||||
)}
|
||||
{pager && (
|
||||
<div className="mb-3 mt-9">
|
||||
|
||||
@@ -5,6 +5,8 @@ export type DiscoverSortOption = "trending" | "popular" | "new" | "updated" | "a
|
||||
|
||||
export interface DiscoverHack extends HackCardAttributes {
|
||||
curatedAt: string | null;
|
||||
/** Sorts uncurated hacks under "Newest", which have no curation date. */
|
||||
approvedAt: string | null;
|
||||
publishedAt: string | null;
|
||||
trendingScore: number;
|
||||
/** The AI label's level per area, for the AI filter; null until the creator fills it in. */
|
||||
@@ -12,7 +14,10 @@ export interface DiscoverHack extends HackCardAttributes {
|
||||
}
|
||||
|
||||
export interface DiscoverData {
|
||||
/** Curated hacks: everything Discover and the homepage list. */
|
||||
hacks: DiscoverHack[];
|
||||
/** Approved hacks outside the curated collection. Discover shows them only when a search looks one up by name. */
|
||||
searchOnly: DiscoverHack[];
|
||||
generatedAt: string;
|
||||
tagGroups: Record<string, string[]>;
|
||||
ungroupedTags: string[];
|
||||
|
||||
52
src/utils/hackNameSearch.test.ts
Normal file
52
src/utils/hackNameSearch.test.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import { matchesHackName } from "./hackNameSearch.ts";
|
||||
|
||||
const crest = { title: "Emerald Crest", author: "@mossfern" };
|
||||
|
||||
test("matches part of the title once the query has 5 characters", () => {
|
||||
assert.equal(matchesHackName("emera", crest), true);
|
||||
assert.equal(matchesHackName("ld cr", crest), true);
|
||||
});
|
||||
|
||||
test("ignores part of the title under 5 characters", () => {
|
||||
assert.equal(matchesHackName("emer", crest), false);
|
||||
assert.equal(matchesHackName("rest", crest), false);
|
||||
});
|
||||
|
||||
test("matches the exact title at any length", () => {
|
||||
assert.equal(matchesHackName("gaia", { title: "Gaia", author: "@someone" }), true);
|
||||
assert.equal(matchesHackName("@", { title: "@", author: "@someone" }), true);
|
||||
});
|
||||
|
||||
test("counts the minimum in characters, not UTF-16 units", () => {
|
||||
assert.equal(matchesHackName("🔥🔥a", { title: "🔥🔥alpha", author: "@someone" }), false);
|
||||
assert.equal(matchesHackName("🔥🔥alp", { title: "🔥🔥alpha", author: "@someone" }), true);
|
||||
});
|
||||
|
||||
test("counts the minimum before lowercasing", () => {
|
||||
// "İ" lowercases to two code points, which would make this 4-letter query look like 5.
|
||||
assert.equal(matchesHackName("MİST", { title: "MİST Valley", author: "@someone" }), false);
|
||||
});
|
||||
|
||||
test("matches the exact author with or without the @", () => {
|
||||
assert.equal(matchesHackName("mossfern", crest), true);
|
||||
assert.equal(matchesHackName("@mossfern", crest), true);
|
||||
assert.equal(matchesHackName("@ax", { title: "Emerald Crest", author: "@ax" }), true);
|
||||
});
|
||||
|
||||
test("ignores part of the author", () => {
|
||||
assert.equal(matchesHackName("mossf", crest), false);
|
||||
assert.equal(matchesHackName("@moss", crest), false);
|
||||
});
|
||||
|
||||
test("ignores case and surrounding spaces", () => {
|
||||
assert.equal(matchesHackName(" EMERALD crest ", crest), true);
|
||||
assert.equal(matchesHackName(" @MossFern", crest), true);
|
||||
});
|
||||
|
||||
test("an empty or blank query matches nothing", () => {
|
||||
assert.equal(matchesHackName("", crest), false);
|
||||
assert.equal(matchesHackName(" ", crest), false);
|
||||
assert.equal(matchesHackName("@", { title: "Emerald Crest", author: "" }), false);
|
||||
});
|
||||
22
src/utils/hackNameSearch.ts
Normal file
22
src/utils/hackNameSearch.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/** The shortest query that can match part of a title. Shorter queries need the exact title or author. */
|
||||
export const MIN_PARTIAL_TITLE_QUERY = 5;
|
||||
|
||||
const normalize = (text: string) => text.trim().toLowerCase();
|
||||
const withoutAt = (name: string) => name.replace(/^@/, "");
|
||||
|
||||
/**
|
||||
* Whether a Discover search is looking up this hack by name. Uncurated hacks only show up for
|
||||
* these lookups, never for browsing searches like a tag or a word from the summary.
|
||||
* Matches part of the title once the query is long enough, or the exact title or author at any
|
||||
* length. Case never matters, and the author's leading `@` is optional.
|
||||
*/
|
||||
export function matchesHackName(query: string, hack: { title: string; author: string }) {
|
||||
const q = normalize(query);
|
||||
if (!q) return false;
|
||||
const title = normalize(hack.title);
|
||||
if (title === q) return true;
|
||||
const name = withoutAt(q);
|
||||
if (name && withoutAt(normalize(hack.author)) === name) return true;
|
||||
// Counted by character before lowercasing, so emoji and letters like "İ" don't pass the minimum early.
|
||||
return [...query.trim()].length >= MIN_PARTIAL_TITLE_QUERY && title.includes(q);
|
||||
}
|
||||
Reference in New Issue
Block a user