diff --git a/src/views/settings/components/Setting.vue b/src/views/settings/components/Setting.vue index 7593fb3d..28080b21 100644 --- a/src/views/settings/components/Setting.vue +++ b/src/views/settings/components/Setting.vue @@ -7,6 +7,7 @@
@@ -15,6 +16,7 @@ v-for="setting in emailAdapterChildren" :key="setting.key"> @@ -24,6 +26,7 @@
{ + return state[group][groupKey][targetKey] !== notEqual +} + +const rulesMap = { + renderIfNotEqual +} + +export const settingFollowsRules = (settingKey, settingGroupKey, state) => { + const rule = rules.find(rule => rule.groupKey === settingGroupKey && rule.key === settingKey) + if (!rule) return true + + const ruleFn = rulesMap[rule.name] + if (!ruleFn) return true + return ruleFn(state, rule) +}