fix: improve content filtering for unknown types

- Unknown content types (systems, news-scrapper) treated as text
- Filter "text" now includes news and unknown types
- Add KNOWN_CONTENT_TYPES set for type detection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-01-20 16:57:44 +00:00
parent 4b3bbe01ef
commit dd5954caad
1 changed files with 19 additions and 2 deletions

View File

@ -28,6 +28,21 @@ export default function ContentFilters({ activeFilter, onFilterChange }) {
); );
} }
// Known content types - anything not in this list is treated as text
const KNOWN_CONTENT_TYPES = new Set([
"photo", "picture", "image",
"video",
"camera", "live", "stream",
"post", "text", "blog",
"news",
"event",
"weather", "traffic"
]);
function isUnknownType(ct) {
return ct && !KNOWN_CONTENT_TYPES.has(ct);
}
// Export filter matching function for reuse // Export filter matching function for reuse
export function matchesContentFilter(post, filter) { export function matchesContentFilter(post, filter) {
if (!filter || filter === "all") return true; if (!filter || filter === "all") return true;
@ -38,14 +53,16 @@ export function matchesContentFilter(post, filter) {
switch (filter) { switch (filter) {
case "links": case "links":
return cat === "news" || ct === "news"; // News links + unknown types with news category (e.g., systems, news-scrapper)
return cat === "news" || ct === "news" || (isUnknownType(ct) && cat === "news");
case "video": case "video":
// Recorded videos only // Recorded videos only
return ct === "video"; return ct === "video";
case "image": case "image":
return hasImage && !hasVideo && ct !== "camera" && ct !== "video"; return hasImage && !hasVideo && ct !== "camera" && ct !== "video";
case "text": case "text":
return ct === "post" || ct === "text" || ct === "blog" || cat === "friends"; // Text posts + news + unknown types default to text (systems, news-scrapper, etc.)
return ct === "post" || ct === "text" || ct === "blog" || ct === "news" || cat === "friends" || cat === "news" || isUnknownType(ct);
case "live": case "live":
// Only live content: cameras (quebec511), live streams - NOT recorded videos // Only live content: cameras (quebec511), live streams - NOT recorded videos
return ct === "live" || ct === "stream" || ct === "camera"; return ct === "live" || ct === "stream" || ct === "camera";