Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions app/settings/server/SettingsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,18 @@ export class SettingsRegistry {

const sorterKey = group && section ? `${ group }_${ section }` : group;

if (sorterKey && this._sorter[sorterKey] == null) {
if (group && section) {
const currentGroupValue = this._sorter[group] ?? 0;
this._sorter[sorterKey] = currentGroupValue * 1000;
}
}

if (sorterKey) {
this._sorter[sorterKey] = this._sorter[sorterKey] ?? -1;
this._sorter[sorterKey]++;
}

const settingFromCode = getSettingDefaults({ _id, type: 'string', section, value, sorter: sorter ?? (sorterKey?.length && this._sorter[sorterKey]), group, ...options }, blockedSettings, hiddenSettings, wizardRequiredSettings);
const settingFromCode = getSettingDefaults({ _id, type: 'string', section, value, sorter: sorter ?? (sorterKey?.length && this._sorter[sorterKey]++), group, ...options }, blockedSettings, hiddenSettings, wizardRequiredSettings);

if (isSettingEnterprise(settingFromCode) && !('invalidValue' in settingFromCode)) {
SystemLogger.error(`Enterprise setting ${ _id } is missing the invalidValue option`);
Expand Down Expand Up @@ -163,9 +169,6 @@ export class SettingsRegistry {
throw new Error('Invalid arguments');
}

this._sorter[_id] = this._sorter[_id] || -1;
this._sorter[_id]++;

const callback = groupOptions instanceof Function ? groupOptions : cb;

const options = groupOptions instanceof Function ? getGroupDefaults(_id, { sorter: this._sorter[_id] }) : getGroupDefaults(_id, { sorter: this._sorter[_id], ...groupOptions });
Expand Down