diff --git a/appinfo/routes.php b/appinfo/routes.php index 9993f8d0e..003d3ed27 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -11,7 +11,12 @@ return [ 'routes' => [ ['name' => 'page#index', 'url' => '/', 'verb' => 'GET'], - ['name' => 'page#indexMyMap', 'url' => '/m/{myMapId}', 'verb' => 'GET'], + [ + 'name' => 'page#indexMyMap', + 'url' => '/m/{myMapId}', + 'verb' => 'GET', + 'requirements' => ['myMapId' => '[0-9]+'], + ], ['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'], ['name' => 'page#openGeoLink', 'url' => '/openGeoLink/{url}', 'verb' => 'GET'], ['name' => 'public_favorite_page#sharedFavoritesCategory', 'url' => '/s/favorites/{token}', 'verb' => 'GET'], diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 2c38fed4b..ae093faad 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -32,7 +32,7 @@ class PageController extends Controller { public function __construct( string $appName, IRequest $request, - private string $userId, + private ?string $userId, private IEventDispatcher $eventDispatcher, IAppConfig $appConfig, private IInitialState $initialState, @@ -68,7 +68,12 @@ public function index(): TemplateResponse { #[NoAdminRequired] #[NoCSRFRequired] public function indexMyMap(int $myMapId, MyMapsService $service): TemplateResponse|RedirectResponse { - $map = $service->getMyMap($myMapId, $this->userId); + $userId = $this->userId; + if ($userId === null) { + throw new \LogicException('User must be logged in'); + } + + $map = $service->getMyMap($myMapId, $userId); if ($map !== null && $map['id'] !== $myMapId) { // Instead of the id of the map containing folder the '.index.maps' file id was passed so redirect // this happens if coming from the files app integration @@ -80,7 +85,7 @@ public function indexMyMap(int $myMapId, MyMapsService $service): TemplateRespon $this->eventDispatcher->dispatchTyped(new LoadSidebar()); $this->eventDispatcher->dispatchTyped(new LoadViewer()); - $params = ['user' => $this->userId]; + $params = ['user' => $userId]; $this->initialState->provideInitialState('photos', $this->appConfig->getValueBool('photos', 'enabled')); $response = new TemplateResponse('maps', 'main', $params); diff --git a/lib/Service/MyMapsService.php b/lib/Service/MyMapsService.php index b02d9e29d..1028642d9 100644 --- a/lib/Service/MyMapsService.php +++ b/lib/Service/MyMapsService.php @@ -150,6 +150,9 @@ public function getAllMyMaps($userId): array { public function getMyMap(int $id, string $userId): ?array { $userFolder = $this->root->getUserFolder($userId); $node = $userFolder->getFirstNodeById($id); + if ($node === null) { + return null; + } if ($node instanceof Folder) { try { $node = $node->get('.index.maps'); diff --git a/src/components/AppNavigationDeviceItem.vue b/src/components/AppNavigationDeviceItem.vue index 77cde914b..b4d2d518e 100644 --- a/src/components/AppNavigationDeviceItem.vue +++ b/src/components/AppNavigationDeviceItem.vue @@ -93,6 +93,8 @@ export default { }, }, + emits: ['click', 'toggle-history', 'zoom', 'export', 'add-to-map-device', 'delete', 'color'], + data() { return { } diff --git a/src/components/AppNavigationFavoritesItem.vue b/src/components/AppNavigationFavoritesItem.vue index a3e919d6b..f289cb271 100644 --- a/src/components/AppNavigationFavoritesItem.vue +++ b/src/components/AppNavigationFavoritesItem.vue @@ -81,9 +81,9 @@ {{ t('maps', 'Zoom to bounds') }} + @update:model-value="$emit('category-share-change', catid, $event)"> {{ c.token ? t('maps', 'Delete share link') : t('maps', 'Create share link') }} import { NcAppNavigationItem, NcActionButton, NcActionLink } from '@nextcloud/vue' -import { isPublic, getToken } from '../utils/common' +import { isPublic, getToken } from '../utils/common.js' import { generateUrl } from '@nextcloud/router' export default { @@ -103,6 +103,8 @@ export default { }, }, + emits: ['click', 'zoom', 'elevation', 'add-to-map-track', 'color'], + data() { return { } diff --git a/src/components/FavoriteEditionForm.vue b/src/components/FavoriteEditionForm.vue index f93479342..604775b3e 100644 --- a/src/components/FavoriteEditionForm.vue +++ b/src/components/FavoriteEditionForm.vue @@ -10,7 +10,7 @@ -