From ba246c357184cb87d3b6437cd000580fd3fb6e39 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 19 Dec 2025 09:49:29 +0100 Subject: [PATCH 1/2] chore: Add config lexicon Signed-off-by: Julius Knorr --- composer/composer/autoload_classmap.php | 1 + composer/composer/autoload_static.php | 1 + lib/AppInfo/Application.php | 2 + lib/ConfigLexicon.php | 80 +++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 lib/ConfigLexicon.php diff --git a/composer/composer/autoload_classmap.php b/composer/composer/autoload_classmap.php index daa77de7338..c602abf082c 100644 --- a/composer/composer/autoload_classmap.php +++ b/composer/composer/autoload_classmap.php @@ -9,6 +9,7 @@ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', 'OCA\\Text\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', 'OCA\\Text\\Command\\ResetDocument' => $baseDir . '/../lib/Command/ResetDocument.php', + 'OCA\\Text\\ConfigLexicon' => $baseDir . '/../lib/ConfigLexicon.php', 'OCA\\Text\\Controller\\AttachmentController' => $baseDir . '/../lib/Controller/AttachmentController.php', 'OCA\\Text\\Controller\\ISessionAwareController' => $baseDir . '/../lib/Controller/ISessionAwareController.php', 'OCA\\Text\\Controller\\NavigationController' => $baseDir . '/../lib/Controller/NavigationController.php', diff --git a/composer/composer/autoload_static.php b/composer/composer/autoload_static.php index ef2fa93317e..255d55aac46 100644 --- a/composer/composer/autoload_static.php +++ b/composer/composer/autoload_static.php @@ -24,6 +24,7 @@ class ComposerStaticInitText 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', 'OCA\\Text\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', 'OCA\\Text\\Command\\ResetDocument' => __DIR__ . '/..' . '/../lib/Command/ResetDocument.php', + 'OCA\\Text\\ConfigLexicon' => __DIR__ . '/..' . '/../lib/ConfigLexicon.php', 'OCA\\Text\\Controller\\AttachmentController' => __DIR__ . '/..' . '/../lib/Controller/AttachmentController.php', 'OCA\\Text\\Controller\\ISessionAwareController' => __DIR__ . '/..' . '/../lib/Controller/ISessionAwareController.php', 'OCA\\Text\\Controller\\NavigationController' => __DIR__ . '/..' . '/../lib/Controller/NavigationController.php', diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 8b069b3823f..d8ad0de0897 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -49,6 +49,8 @@ public function __construct(array $params = []) { } public function register(IRegistrationContext $context): void { + $context->registerConfigLexicon(\OCA\Text\ConfigLexicon::class); + $context->registerEventListener(RegisterDirectEditorEvent::class, RegisterDirectEditorEventListener::class); $context->registerEventListener(LoadViewer::class, LoadViewerListener::class); $context->registerEventListener(LoadAdditionalScriptsEvent::class, FilesLoadAdditionalScriptsListener::class); diff --git a/lib/ConfigLexicon.php b/lib/ConfigLexicon.php new file mode 100644 index 00000000000..b1bce764ae4 --- /dev/null +++ b/lib/ConfigLexicon.php @@ -0,0 +1,80 @@ + Date: Fri, 19 Dec 2025 09:52:15 +0100 Subject: [PATCH 2/2] chore: Switch app config to boolean values Signed-off-by: Julius Knorr --- lib/ConfigLexicon.php | 12 ++++++------ lib/Service/ConfigService.php | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/ConfigLexicon.php b/lib/ConfigLexicon.php index b1bce764ae4..8a7a5a48ba7 100644 --- a/lib/ConfigLexicon.php +++ b/lib/ConfigLexicon.php @@ -30,22 +30,22 @@ public function getAppConfigs(): array { ), new Entry( key: 'open_read_only_enabled', - type: ValueType::STRING, - defaultRaw: '0', + type: ValueType::BOOL, + defaultRaw: false, definition: 'Whether opening files in read-only mode is enabled', lazy: false, ), new Entry( key: 'rich_editing_enabled', - type: ValueType::STRING, - defaultRaw: '1', + type: ValueType::BOOL, + defaultRaw: true, definition: 'Whether rich editing is enabled', lazy: false, ), new Entry( key: 'workspace_available', - type: ValueType::STRING, - defaultRaw: '1', + type: ValueType::BOOL, + defaultRaw: true, definition: 'Whether rich workspace feature is available', lazy: false, ), diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 08ac8b2b1e6..36135eb2915 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -25,18 +25,18 @@ public function getDefaultFileExtension(): string { } public function isOpenReadOnlyEnabled(): bool { - return $this->appConfig->getValueString(Application::APP_NAME, 'open_read_only_enabled', '0') === '1'; + return $this->appConfig->getValueBool(Application::APP_NAME, 'open_read_only_enabled'); } public function isRichEditingEnabled(): bool { - return ($this->appConfig->getValueString(Application::APP_NAME, 'rich_editing_enabled', '1') === '1'); + return $this->appConfig->getValueBool(Application::APP_NAME, 'rich_editing_enabled', true); } public function isRichWorkspaceAvailable(): bool { if ($this->config->getSystemValueBool('enable_non-accessible_features', true) === false) { return false; } - return $this->appConfig->getValueString(Application::APP_NAME, 'workspace_available', '1') === '1'; + return $this->appConfig->getValueBool(Application::APP_NAME, 'workspace_available', true); } public function isRichWorkspaceEnabledForUser(?string $userId): bool {