From ad3fd5700ffd04e27a3b9e05c891b004d56752a7 Mon Sep 17 00:00:00 2001 From: zeppi Date: Thu, 22 Jul 2021 16:04:46 -0400 Subject: [PATCH] default search types from config --- config.js | 1 + ui/redux/reducers/search.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.js b/config.js index cd68045b2..1267a2ff6 100644 --- a/config.js +++ b/config.js @@ -64,6 +64,7 @@ const config = { CUSTOM_HOMEPAGE: process.env.CUSTOM_HOMEPAGE === 'true', SHOW_TAGS_INTRO: process.env.SHOW_TAGS_INTRO === 'true', AVATAR_DEFAULT: process.env.AVATAR_DEFAULT, + LIGHTHOUSE_DEFAULT_TYPES: process.env.LIGHTHOUSE_DEFAULT_TYPES, }; config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`; diff --git a/ui/redux/reducers/search.js b/ui/redux/reducers/search.js index 3253c95b2..7730eeaa5 100644 --- a/ui/redux/reducers/search.js +++ b/ui/redux/reducers/search.js @@ -3,17 +3,19 @@ import * as ACTIONS from 'constants/action_types'; import { handleActions } from 'util/redux-utils'; import { SEARCH_OPTIONS, SEARCH_PAGE_SIZE } from 'constants/search'; import { createNormalizedSearchKey } from 'util/search'; +import { LIGHTHOUSE_DEFAULT_TYPES } from 'config'; +const defaultSearchTypes = LIGHTHOUSE_DEFAULT_TYPES && LIGHTHOUSE_DEFAULT_TYPES.split(','); const defaultState: SearchState = { // $FlowFixMe options: { [SEARCH_OPTIONS.RESULT_COUNT]: SEARCH_PAGE_SIZE, [SEARCH_OPTIONS.CLAIM_TYPE]: SEARCH_OPTIONS.INCLUDE_FILES_AND_CHANNELS, - [SEARCH_OPTIONS.MEDIA_AUDIO]: true, - [SEARCH_OPTIONS.MEDIA_VIDEO]: true, - [SEARCH_OPTIONS.MEDIA_TEXT]: true, - [SEARCH_OPTIONS.MEDIA_IMAGE]: true, - [SEARCH_OPTIONS.MEDIA_APPLICATION]: true, + [SEARCH_OPTIONS.MEDIA_AUDIO]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_AUDIO), + [SEARCH_OPTIONS.MEDIA_VIDEO]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_VIDEO), + [SEARCH_OPTIONS.MEDIA_TEXT]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_TEXT), + [SEARCH_OPTIONS.MEDIA_IMAGE]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_IMAGE), + [SEARCH_OPTIONS.MEDIA_APPLICATION]: defaultSearchTypes.includes(SEARCH_OPTIONS.MEDIA_APPLICATION), }, urisByQuery: {}, hasReachedMaxResultsLength: {},