diff --git a/lib/Controller/ApiBase.php b/lib/Controller/ApiBase.php index fc6727f7..865c2d5b 100644 --- a/lib/Controller/ApiBase.php +++ b/lib/Controller/ApiBase.php @@ -376,7 +376,7 @@ class ApiBase extends Controller */ protected function placesIsEnabled(): bool { - return \OCA\Memories\Util::placesGISType() !== 0; + return \OCA\Memories\Util::placesGISType() > 0; } /** diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 984131d1..dff5c116 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -132,6 +132,9 @@ class PageController extends Controller // Video configuration $initialState->provideInitialState('notranscode', $config->getSystemValue('memories.no_transcode', 'UNSET')); $initialState->provideInitialState('video_default_quality', $config->getSystemValue('memories.video_default_quality', '0')); + + // Geo configuration + $initialState->provideInitialState('places_gis', $config->getSystemValue('memories.gis_type', '-1')); } /** diff --git a/lib/Db/TimelineQuery.php b/lib/Db/TimelineQuery.php index ec6c39d7..f281cdb9 100644 --- a/lib/Db/TimelineQuery.php +++ b/lib/Db/TimelineQuery.php @@ -92,8 +92,9 @@ class TimelineQuery } } - $address = null; - if (!$basic && \OCA\Memories\Util::placesGISType() !== 0) { + $gisType = \OCA\Memories\Util::placesGISType(); + $address = -1 === $gisType ? 'Geocoding Unconfigured' : null; + if (!$basic && $gisType > 0) { $qb = $this->connection->getQueryBuilder(); $qb->select('e.name') ->from('memories_places', 'mp') diff --git a/lib/Util.php b/lib/Util.php index 666d7a62..8496a30f 100644 --- a/lib/Util.php +++ b/lib/Util.php @@ -148,7 +148,7 @@ class Util */ public static function placesGISType(): int { - return \OC::$server->get(\OCP\IConfig::class)->getSystemValue('memories.gis_type', 0); + return (int) \OC::$server->get(\OCP\IConfig::class)->getSystemValue('memories.gis_type', -1); } /** diff --git a/src/App.vue b/src/App.vue index 355d6f6b..d652a22d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -252,6 +252,7 @@ export default defineComponent({ name: "places", icon: MarkerIcon, title: t("memories", "Places"), + if: this.config_placesGis > 0, }, { name: "tags", diff --git a/src/mixins/UserConfig.ts b/src/mixins/UserConfig.ts index 9377f7c9..7c4c14fa 100644 --- a/src/mixins/UserConfig.ts +++ b/src/mixins/UserConfig.ts @@ -39,6 +39,8 @@ export default defineComponent({ config_mapsEnabled: Boolean(loadState("memories", "maps", "")), config_albumsEnabled: Boolean(loadState("memories", "albums", "")), + config_placesGis: Number(loadState("memories", "places_gis", "-1")), + config_squareThumbs: localStorage.getItem("memories_squareThumbs") === "1", config_showFaceRect: localStorage.getItem("memories_showFaceRect") === "1", diff --git a/src/vue-globals.d.ts b/src/vue-globals.d.ts index 9f6c61d2..fd82de0e 100644 --- a/src/vue-globals.d.ts +++ b/src/vue-globals.d.ts @@ -23,6 +23,7 @@ declare module "vue" { config_facerecognitionEnabled: boolean; config_mapsEnabled: boolean; config_albumsEnabled: boolean; + config_placesGis: number; config_squareThumbs: boolean; config_showFaceRect: boolean; config_eventName: string;