places: hide when not configured/enabled

pull/395/head
Varun Patil 2023-02-05 19:55:39 -08:00
parent bae5f99b2b
commit b25731e9ac
7 changed files with 12 additions and 4 deletions

View File

@ -376,7 +376,7 @@ class ApiBase extends Controller
*/
protected function placesIsEnabled(): bool
{
return \OCA\Memories\Util::placesGISType() !== 0;
return \OCA\Memories\Util::placesGISType() > 0;
}
/**

View File

@ -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'));
}
/**

View File

@ -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')

View File

@ -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);
}
/**

View File

@ -252,6 +252,7 @@ export default defineComponent({
name: "places",
icon: MarkerIcon,
title: t("memories", "Places"),
if: this.config_placesGis > 0,
},
{
name: "tags",

View File

@ -39,6 +39,8 @@ export default defineComponent({
config_mapsEnabled: Boolean(loadState("memories", "maps", <string>"")),
config_albumsEnabled: Boolean(loadState("memories", "albums", <string>"")),
config_placesGis: Number(loadState("memories", "places_gis", <string>"-1")),
config_squareThumbs: localStorage.getItem("memories_squareThumbs") === "1",
config_showFaceRect: localStorage.getItem("memories_showFaceRect") === "1",

View File

@ -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;