Add search filters feature flag

This commit is contained in:
thePR0M3TH3AN committed 2026-01-23 13:54:23 -05:00
1 parent ba1d4fa083
commit f3db9e7630
2 files changed
+33 -1

No files matched your search

+28 -1
View File
@@ -147,6 +147,7 @@ const DEFAULT_FLAGS = Object.freeze({
FEATURE_WATCH_HISTORY_V2: true,
FEATURE_PUBLISH_NIP71: false,
FEATURE_HASHTAG_PREFERENCES: false,
FEATURE_SEARCH_FILTERS: false,
FEATURE_TRUST_SEEDS: true, // Rollback: disable to drop baseline trust seeds without code changes.
FEATURE_TRUSTED_HIDE_CONTROLS: true,
FEATURE_IMPROVED_COMMENT_FETCHING: true, // Default true for comment persistence fixes
@@ -166,6 +167,7 @@ const runtimeFlags = (() => {
FEATURE_WATCH_HISTORY_V2: DEFAULT_FLAGS.FEATURE_WATCH_HISTORY_V2,
FEATURE_PUBLISH_NIP71: DEFAULT_FLAGS.FEATURE_PUBLISH_NIP71,
FEATURE_HASHTAG_PREFERENCES: DEFAULT_FLAGS.FEATURE_HASHTAG_PREFERENCES,
FEATURE_SEARCH_FILTERS: DEFAULT_FLAGS.FEATURE_SEARCH_FILTERS,
FEATURE_TRUST_SEEDS: DEFAULT_FLAGS.FEATURE_TRUST_SEEDS,
FEATURE_TRUSTED_HIDE_CONTROLS: DEFAULT_FLAGS.FEATURE_TRUSTED_HIDE_CONTROLS,
FEATURE_IMPROVED_COMMENT_FETCHING:
@@ -200,6 +202,11 @@ export let FEATURE_HASHTAG_PREFERENCES = coerceBoolean(
DEFAULT_FLAGS.FEATURE_HASHTAG_PREFERENCES
);
export let FEATURE_SEARCH_FILTERS = coerceBoolean(
runtimeFlags.FEATURE_SEARCH_FILTERS,
DEFAULT_FLAGS.FEATURE_SEARCH_FILTERS
);
export let FEATURE_TRUST_SEEDS = coerceBoolean(
runtimeFlags.FEATURE_TRUST_SEEDS,
DEFAULT_FLAGS.FEATURE_TRUST_SEEDS
@@ -282,6 +289,20 @@ Object.defineProperty(runtimeFlags, "FEATURE_HASHTAG_PREFERENCES", {
},
});
Object.defineProperty(runtimeFlags, "FEATURE_SEARCH_FILTERS", {
configurable: true,
enumerable: true,
get() {
return FEATURE_SEARCH_FILTERS;
},
set(next) {
FEATURE_SEARCH_FILTERS = coerceBoolean(
next,
DEFAULT_FLAGS.FEATURE_SEARCH_FILTERS
);
},
});
Object.defineProperty(runtimeFlags, "FEATURE_TRUST_SEEDS", {
configurable: true,
enumerable: true,
@@ -370,6 +391,7 @@ runtimeFlags.URL_FIRST_ENABLED = URL_FIRST_ENABLED;
runtimeFlags.FEATURE_WATCH_HISTORY_V2 = FEATURE_WATCH_HISTORY_V2;
runtimeFlags.FEATURE_PUBLISH_NIP71 = FEATURE_PUBLISH_NIP71;
runtimeFlags.FEATURE_HASHTAG_PREFERENCES = FEATURE_HASHTAG_PREFERENCES;
runtimeFlags.FEATURE_SEARCH_FILTERS = FEATURE_SEARCH_FILTERS;
runtimeFlags.FEATURE_TRUST_SEEDS = FEATURE_TRUST_SEEDS;
runtimeFlags.FEATURE_TRUSTED_HIDE_CONTROLS = FEATURE_TRUSTED_HIDE_CONTROLS;
runtimeFlags.FEATURE_IMPROVED_COMMENT_FETCHING =
@@ -412,10 +434,16 @@ export function setHashtagPreferencesEnabled(next) {
return FEATURE_HASHTAG_PREFERENCES;
}
export function setSearchFiltersEnabled(next) {
runtimeFlags.FEATURE_SEARCH_FILTERS = next;
return FEATURE_SEARCH_FILTERS;
}
export function resetRuntimeFlags() {
setUrlFirstEnabled(DEFAULT_FLAGS.URL_FIRST_ENABLED);
setWatchHistoryV2Enabled(DEFAULT_FLAGS.FEATURE_WATCH_HISTORY_V2);
setHashtagPreferencesEnabled(DEFAULT_FLAGS.FEATURE_HASHTAG_PREFERENCES);
setSearchFiltersEnabled(DEFAULT_FLAGS.FEATURE_SEARCH_FILTERS);
setTrustSeedsEnabled(DEFAULT_FLAGS.FEATURE_TRUST_SEEDS);
setTrustedHideControlsEnabled(DEFAULT_FLAGS.FEATURE_TRUSTED_HIDE_CONTROLS);
setImprovedCommentFetchingEnabled(
@@ -450,4 +478,3 @@ export function getTrustedMuteHideThreshold() {
export function getTrustedSpamHideThreshold() {
return TRUSTED_SPAM_HIDE_THRESHOLD;
}
+5
View File
@@ -42,6 +42,7 @@ import {
LOCKDOWN_TITLE,
LOCKDOWN_MESSAGE,
} from "./config.js";
import { FEATURE_SEARCH_FILTERS } from "./constants.js";
import { createHashChangeHandler } from "./hashChangeHandler.js";
import AuthService from "./services/authService.js";
import getAuthProvider, {
@@ -1213,6 +1214,10 @@ async function bootstrapInterface() {
setHashView(buildSearchHashFromState(nextState));
};
searchFilterButtons.forEach((button) => {
if (!FEATURE_SEARCH_FILTERS) {
button.classList.add("hidden");
return;
}
attachSearchFiltersPopover(button, {
getState: getSearchFilterState,
onApply: applySearchFilters,