Simplify selectShowMatureContent
This commit is contained in:
parent
8deac56e40
commit
d03b3fd50d
1 changed files with 9 additions and 3 deletions
|
@ -15,13 +15,19 @@ export const selectFindingFFmpeg = (state) => selectState(state).findingFFmpeg |
|
||||||
export const selectClientSettings = (state) => selectState(state).clientSettings || {};
|
export const selectClientSettings = (state) => selectState(state).clientSettings || {};
|
||||||
export const selectLoadedLanguages = (state) => selectState(state).loadedLanguages || {};
|
export const selectLoadedLanguages = (state) => selectState(state).loadedLanguages || {};
|
||||||
|
|
||||||
|
export const selectClientSetting = (state, setting) => {
|
||||||
|
const clientSettings = selectClientSettings(state);
|
||||||
|
return clientSettings ? clientSettings[setting] : undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO - kill this
|
||||||
export const makeSelectClientSetting = (setting) =>
|
export const makeSelectClientSetting = (setting) =>
|
||||||
createSelector(selectClientSettings, (settings) => (settings ? settings[setting] : undefined));
|
createSelector(selectClientSettings, (settings) => (settings ? settings[setting] : undefined));
|
||||||
|
|
||||||
// refactor me
|
// refactor me
|
||||||
export const selectShowMatureContent = !ENABLE_MATURE
|
export const selectShowMatureContent = (state) => {
|
||||||
? createSelector(() => false)
|
return !ENABLE_MATURE ? false : selectClientSetting(state, SETTINGS.SHOW_MATURE);
|
||||||
: makeSelectClientSetting(SETTINGS.SHOW_MATURE);
|
};
|
||||||
|
|
||||||
// and me
|
// and me
|
||||||
export const selectShowRepostedContent = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS);
|
export const selectShowRepostedContent = makeSelectClientSetting(SETTINGS.HIDE_REPOSTS);
|
||||||
|
|
Loading…
Add table
Reference in a new issue