Skip to content
Open
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
10 changes: 9 additions & 1 deletion lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class ConfigController extends Controller {
public const CALENDAR_SCOPE = 'https://www.googleapis.com/auth/calendar.readonly';
public const CALENDAR_EVENTS_SCOPE = 'https://www.googleapis.com/auth/calendar.events.readonly';

public const INT_CONFIGS = ['nb_imported_files', 'drive_imported_size', 'last_drive_import_timestamp', 'drive_import_job_last_start'];

public function __construct(
string $appName,
IRequest $request,
Expand Down Expand Up @@ -72,7 +74,13 @@ public function setConfig(array $values): DataResponse {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
foreach ($values as $key => $value) {
$this->userConfig->setValueString($this->userId, Application::APP_ID, $key, $value, lazy: true);
if (in_array($key, self::INT_CONFIGS, true)) {
$intValue = (int)$value;
$this->userConfig->setValueInt($this->userId, Application::APP_ID, $key, $intValue, lazy: true);
} else {
$value = (string)$value;
$this->userConfig->setValueString($this->userId, Application::APP_ID, $key, $value, lazy: true);
}
}
$result = [];

Expand Down
Loading