fix(plugins): Setting a plugin setting to None removes that setting

This commit is contained in:
Ferdinand Thiessen 2021-12-06 23:44:41 +01:00
parent f6c229d2ef
commit dca52b764c
1 changed files with 4 additions and 1 deletions

View File

@ -96,7 +96,10 @@ class Plugin:
.one_or_none()
)
if setting is not None:
setting.value = value
if value is None:
db.session.delete(setting)
else:
setting.value = value
else:
db.session.add(_PluginSetting(plugin=self.name, name=name, value=value))
db.session.commit()