Compare commits

..

No commits in common. "0dbc726f64404bf6a1c0a22b0fc80dfff2f2ace8" and "16ccd0d35f34389594490d7140d8146923671452" have entirely different histories.

View file

@ -57,7 +57,7 @@ export default abstract class SettingHelper {
}
let processedValue = rawValue;
if (typeof settingType.type === "string" && settingType.type.includes("/crypt") && processedValue != "") {
if (typeof settingType.type === "string" && settingType.type.includes("/crypt")) {
processedValue = CodingHelper.decrypt(APPLICATION_SECRET, processedValue);
}
@ -76,7 +76,7 @@ export default abstract class SettingHelper {
* @param value The value to set
*/
public static async setSetting<K extends SettingString>(key: K, value: SettingValueMapping[K]): Promise<void> {
if (value === undefined || value === null || value == "") {
if (value === undefined || value === null) {
if (key != "mail.password") this.resetSetting(key);
return;
}
@ -93,7 +93,7 @@ export default abstract class SettingHelper {
newValue = CodingHelper.encrypt(APPLICATION_SECRET, stringValue);
}
this.settings[key] = newValue;
this.settings[key] = stringValue;
const [topic, settingKey] = key.split(".") as [SettingTopic, string];
await SettingCommandHandler.create({
@ -265,7 +265,9 @@ export default abstract class SettingHelper {
* @param oldValue The old value
*/
private static notifyListeners(key: SettingString, newValue: any, oldValue: any): void {
const callbacks = this.listeners.get(key) ?? [];
if (!this.listeners.has(key)) return;
const callbacks = this.listeners.get(key)!;
for (const callback of callbacks) {
try {
callback(newValue, oldValue);
@ -274,7 +276,7 @@ export default abstract class SettingHelper {
}
}
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic) ?? [];
const topicCallbacks = this.topicListeners.get(key.split(".")[0] as SettingTopic)!;
for (const callback of topicCallbacks) {
try {
callback();