diff --git a/lib/Controller/OtherController.php b/lib/Controller/OtherController.php
index 10fd5726..2e0e3f12 100644
--- a/lib/Controller/OtherController.php
+++ b/lib/Controller/OtherController.php
@@ -83,8 +83,9 @@ class OtherController extends GenericApiController
'places_gis' => Util::getSystemConfig('memories.gis_type'),
'systemtags_enabled' => Util::tagsIsEnabled(),
- 'recognize_enabled' => Util::recognizeIsEnabled(),
'albums_enabled' => Util::albumsIsEnabled(),
+ 'recognize_installed' => Util::recognizeIsInstalled(),
+ 'recognize_enabled' => Util::recognizeIsEnabled(),
'facerecognition_installed' => Util::facerecognitionIsInstalled(),
'facerecognition_enabled' => Util::facerecognitionIsEnabled(),
'preview_generator_enabled' => Util::previewGeneratorIsEnabled(),
diff --git a/lib/Util.php b/lib/Util.php
index b18ad1e0..bd50a32a 100644
--- a/lib/Util.php
+++ b/lib/Util.php
@@ -84,6 +84,23 @@ class Util
* Check if recognize is enabled for this user.
*/
public static function recognizeIsEnabled(): bool
+ {
+ if (!self::recognizeIsInstalled()) {
+ return false;
+ }
+
+ $config = \OC::$server->get(IAppConfig::class);
+ if ('true' !== $config->getValue('recognize', 'faces.enabled', 'false')) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Check if recognize is installed.
+ */
+ public static function recognizeIsInstalled(): bool
{
$appManager = \OC::$server->get(IAppManager::class);
@@ -96,11 +113,6 @@ class Util
return false;
}
- $c = \OC::$server->get(IAppConfig::class);
- if ('true' !== $c->getValue('recognize', 'faces.enabled', 'false')) {
- return false;
- }
-
return true;
}
@@ -109,16 +121,21 @@ class Util
*/
public static function facerecognitionIsEnabled(): bool
{
+ if (!self::facerecognitionIsInstalled()) {
+ return false;
+ }
+
try {
$uid = self::getUID();
} catch (\Exception $e) {
return false;
}
- $config = \OC::$server->get(IConfig::class);
- $e = $config->getUserValue($uid, 'facerecognition', 'enabled', 'false');
+ $enabled = \OC::$server->get(IConfig::class)
+ ->getUserValue($uid, 'facerecognition', 'enabled', 'false')
+ ;
- return 'true' === $e;
+ return 'true' === $enabled;
}
/**
diff --git a/src/App.vue b/src/App.vue
index bd8876fe..b7a4cd2d 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -168,7 +168,7 @@ export default defineComponent({
return false;
}
- if (this.config.facerecognition_enabled) {
+ if (this.config.facerecognition_installed) {
return t('memories', 'People (Recognize)');
}
diff --git a/src/components/admin/sections/Apps.vue b/src/components/admin/sections/Apps.vue
index 22ca7100..cea9be74 100644
--- a/src/components/admin/sections/Apps.vue
+++ b/src/components/admin/sections/Apps.vue
@@ -13,11 +13,10 @@
{{
sconfig.recognize_enabled
- ? t('memories', 'Recognize is installed and enabled.')
- : t(
- 'memories',
- 'Recognize is not installed. Some features like face recognition and object tagging may be unavailable.'
- )
+ ? t('memories', 'Recognize is installed and enabled for face recognition.')
+ : sconfig.recognize_installed
+ ? t('memories', 'Recognize is installed but not enabled for face recognition.')
+ : t('memories', 'Recognize is not installed. Face recognition and object tagging may be unavailable.')
}}
diff --git a/src/services/static-config.ts b/src/services/static-config.ts
index a89088a0..1dd57b37 100644
--- a/src/services/static-config.ts
+++ b/src/services/static-config.ts
@@ -103,8 +103,9 @@ class StaticConfig {
places_gis: -1,
systemtags_enabled: false,
- recognize_enabled: false,
albums_enabled: false,
+ recognize_installed: false,
+ recognize_enabled: false,
facerecognition_installed: false,
facerecognition_enabled: false,
preview_generator_enabled: false,
diff --git a/src/types.ts b/src/types.ts
index 8f5f61ff..09fc7187 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -236,8 +236,9 @@ export type IConfig = {
places_gis: number;
systemtags_enabled: boolean;
- recognize_enabled: boolean;
albums_enabled: boolean;
+ recognize_installed: boolean;
+ recognize_enabled: boolean;
facerecognition_installed: boolean;
facerecognition_enabled: boolean;
preview_generator_enabled: boolean;