Merge pull request #2562 from PR0M3TH3AN/cleanup-search-filter-modal-comments-6348314982770636070

🧹 Cleanup commented-out logic in SearchFilterModal.js
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-16 11:50:31 -05:00
commit 40acc48e49
1 file changed
+1 -31
+1 -31
View File
@@ -355,10 +355,6 @@ function applyFilters() {
filters.tags = Array.from(selectedTags);
// Duration
// (Simplified logic: taking the last checked one or union? The original popover logic allowed multiple?
// Let's look at the original logic in SearchFiltersPopover.js:
// It collected ranges into an array and took min of mins and max of maxes.
// Effectively treating them as OR if multiple selected (e.g. Short OR Medium -> 0 to 1200).
const ranges = [];
if (durationShortCheckbox.checked) ranges.push({ min: null, max: 300 });
if (durationMediumCheckbox.checked) ranges.push({ min: 300, max: 1200 });
@@ -368,20 +364,6 @@ function applyFilters() {
const mins = ranges.map(r => r.min).filter(v => v !== null);
const maxes = ranges.map(r => r.max).filter(v => v !== null);
// If any range has min=null (Short), the overall min is null.
// If any range has max=null (Long), the overall max is null.
// Actually, logic:
// Short (0-300) + Medium (300-1200) = 0-1200.
// Short + Long = 0-300 AND 1200+. Currently filter schema supports min/max seconds as a single range.
// It doesn't support disjoint ranges.
// The original logic:
// filters.duration.minSeconds = mins.length ? Math.min(...mins) : null;
// filters.duration.maxSeconds = maxes.length ? Math.max(...maxes) : null;
// This implies union of ranges IF they are contiguous. If disjoint (Short + Long), it creates 0 to infinity (min=0, max=null is wrong, max of maxes? Long has max=null).
// Let's stick to original logic.
// min: Math.min of all explicit mins. If Short is there, min is null.
// max: Math.max of all explicit maxes. If Long is there, max is null.
const hasNullMin = ranges.some(r => r.min === null);
const hasNullMax = ranges.some(r => r.max === null);
@@ -401,19 +383,7 @@ function applyFilters() {
if (nsfwChecked) {
filters.nsfw = "true";
} else {
filters.nsfw = "any"; // or "false"? DEFAULT is "any".
// Wait, original popover logic:
// if (nsfwSwitch?.getAttribute("aria-checked") === "true") { filters.nsfw = "true"; }
// else { ... it defaults to cloneDefaultFilters which is 'any' }
// Wait, DEFAULT_FILTERS.nsfw is 'any'.
// If switch is off, it remains 'any' (showing sensitive content if user allows?).
// Usually NSFW toggle means "Show me NSFW".
// If off, it might mean "Filter out NSFW" or "Show Any".
// Let's assume 'any' means standard behavior (hide usually unless safe mode off?).
// Actually searchFilters.js says:
// filters.nsfw = "any" (default).
// So if I don't touch it, it's 'any'.
// If I toggle it ON, it becomes 'true'.
filters.nsfw = "any";
}
// Update State