Revert "modify correct profile apiOptionsSet"
This reverts commit 51c35c9f30
.
This commit is contained in:
parent
51c35c9f30
commit
9641747ba1
@ -23,7 +23,7 @@ function apiOptionsGet(optionsContext) {
|
|||||||
|
|
||||||
async function apiOptionsSet(changedOptions, optionsContext, source) {
|
async function apiOptionsSet(changedOptions, optionsContext, source) {
|
||||||
const backend = utilBackend();
|
const backend = utilBackend();
|
||||||
const {profileIndex} = backend.getProfileFromContext(optionsContext);
|
const {depth} = optionsContext;
|
||||||
let options = await apiOptionsGetFull();
|
let options = await apiOptionsGetFull();
|
||||||
|
|
||||||
function getValuePaths(obj) {
|
function getValuePaths(obj) {
|
||||||
@ -63,7 +63,7 @@ async function apiOptionsSet(changedOptions, optionsContext, source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let [value, path] of getValuePaths(changedOptions)) {
|
for (let [value, path] of getValuePaths(changedOptions)) {
|
||||||
modifyOption(path, value, options.profiles[profileIndex].options);
|
modifyOption(path, value, options.profiles[depth].options);
|
||||||
}
|
}
|
||||||
|
|
||||||
await optionsSave(options);
|
await optionsSave(options);
|
||||||
|
@ -122,15 +122,15 @@ class Backend {
|
|||||||
if (typeof optionsContext.index === 'number') {
|
if (typeof optionsContext.index === 'number') {
|
||||||
return profiles[optionsContext.index];
|
return profiles[optionsContext.index];
|
||||||
}
|
}
|
||||||
const {profile} = this.getProfileFromContext(optionsContext);
|
const profile = this.getProfileFromContext(optionsContext);
|
||||||
return profile !== null ? profile : this.options.profiles[this.options.profileCurrent];
|
return profile !== null ? profile : this.options.profiles[this.options.profileCurrent];
|
||||||
}
|
}
|
||||||
|
|
||||||
getProfileFromContext(optionsContext) {
|
getProfileFromContext(optionsContext) {
|
||||||
for (const [profileIndex, profile] of this.options.profiles.entries()) {
|
for (const profile of this.options.profiles) {
|
||||||
const conditionGroups = profile.conditionGroups;
|
const conditionGroups = profile.conditionGroups;
|
||||||
if (conditionGroups.length > 0 && Backend.testConditionGroups(conditionGroups, optionsContext)) {
|
if (conditionGroups.length > 0 && Backend.testConditionGroups(conditionGroups, optionsContext)) {
|
||||||
return {profileIndex, profile};
|
return profile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user