Skip to content

Commit 1bebdce

Browse files
committed
Fix type conflict exception for user config
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
1 parent 73fbe7a commit 1bebdce

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

lib/Controller/ConfigController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class ConfigController extends Controller {
4242
public const CALENDAR_SCOPE = 'https://www.googleapis.com/auth/calendar.readonly';
4343
public const CALENDAR_EVENTS_SCOPE = 'https://www.googleapis.com/auth/calendar.events.readonly';
4444

45+
public const INT_CONFIGS = ['nb_imported_files', 'drive_imported_size', 'last_drive_import_timestamp', 'drive_import_job_last_start'];
46+
4547
public function __construct(
4648
string $appName,
4749
IRequest $request,
@@ -72,7 +74,11 @@ public function setConfig(array $values): DataResponse {
7274
return new DataResponse([], Http::STATUS_BAD_REQUEST);
7375
}
7476
foreach ($values as $key => $value) {
75-
$this->userConfig->setValueString($this->userId, Application::APP_ID, $key, $value, lazy: true);
77+
if (in_array($key, self::INT_CONFIGS, true)) {
78+
$this->userConfig->setValueInt($this->userId, Application::APP_ID, $key, $value, lazy: true);
79+
} else {
80+
$this->userConfig->setValueString($this->userId, Application::APP_ID, $key, $value, lazy: true);
81+
}
7682
}
7783
$result = [];
7884

src/components/PersonalSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,9 @@ export default {
644644
const req = {
645645
values: {
646646
importing_drive: '0',
647-
last_drive_import_timestamp: '0',
648-
nb_imported_files: '0',
649-
drive_imported_size: '0',
647+
last_drive_import_timestamp: 0,
648+
nb_imported_files: 0,
649+
drive_imported_size: 0,
650650
},
651651
}
652652
const url = generateUrl('/apps/integration_google/config')

0 commit comments

Comments
 (0)