feat: exclude specific profile fields from search filter UI
This commit is contained in:
@@ -308,7 +308,19 @@ export class ProfileFieldsService {
|
||||
return opt.label.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '') === 'prefer_not_to_say';
|
||||
};
|
||||
|
||||
// Entire fields to hide from search filter UI (still usable on profile forms via admin)
|
||||
const normalizeKey = (s: string) =>
|
||||
s.toLowerCase().replace(/[^a-z0-9]+/g, '_').replace(/^_+|_+$/g, '');
|
||||
const EXCLUDED_FIELD_KEYS = new Set([
|
||||
'what_sets_us_apart',
|
||||
'what_sets_you_apart',
|
||||
]);
|
||||
const isExcludedField = (field: { slug: string; name: string }) =>
|
||||
EXCLUDED_FIELD_KEYS.has(normalizeKey(field.slug)) ||
|
||||
EXCLUDED_FIELD_KEYS.has(normalizeKey(field.name));
|
||||
|
||||
for (const field of fields) {
|
||||
if (isExcludedField(field)) continue;
|
||||
const rawOptions = (field.options as { label: string; value: string }[]) || [];
|
||||
const fieldOptions = rawOptions.filter((opt) => !isExcludedOption(opt));
|
||||
const normalizedName = field.name.toLowerCase().trim();
|
||||
|
||||
Reference in New Issue
Block a user