Skip to content

Commit 4095228

Browse files
committed
fix: Save notes default folder
Signed-off-by: Enjeck C. <patrathewhiz@gmail.com>
1 parent c2c8427 commit 4095228

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/Service/SettingsService.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public function set(string $uid, array $settings, bool $writeDefaults = false) :
112112
if ($value !== null && array_key_exists($name, $this->attrs)) {
113113
$settings[$name] = $value = $this->attrs[$name]['validate']($value);
114114
}
115+
if ($name === 'notesPath' && $value !== null) {
116+
continue;
117+
}
115118
$default = is_callable($this->attrs[$name]['default']) ? $this->attrs[$name]['default']($uid) : $this->attrs[$name]['default'];
116119
if (!$writeDefaults && (!array_key_exists($name, $this->attrs)
117120
|| $value === null
@@ -149,18 +152,22 @@ public function getAll(string $uid, $saveInitial = false) : \stdClass {
149152
$settings = $this->getSettingsFromDB($uid);
150153
// use default for empty settings
151154
$toBeSaved = false;
155+
$toSaveNotesPath = false;
152156
foreach ($this->attrs as $name => $attr) {
153157
if (!property_exists($settings, $name)) {
154158
$defaultValue = $attr['default'];
155159
if (is_callable($defaultValue)) {
156160
$settings->{$name} = $defaultValue($uid);
157161
$toBeSaved = $saveInitial;
162+
if ($name === 'notesPath') {
163+
$toSaveNotesPath = true;
164+
}
158165
} else {
159166
$settings->{$name} = $defaultValue;
160167
}
161168
}
162169
}
163-
if ($toBeSaved) {
170+
if ($toSaveNotesPath || $toBeSaved) {
164171
$this->set($uid, (array)$settings);
165172
}
166173
return $settings;

0 commit comments

Comments
 (0)