Skip to content

Commit 8f4819c

Browse files
committed
Let adminId go through when accessed through map.geo.admin.ch
1 parent a370c2f commit 8f4819c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/router/legacyPermalinkManagement.routerPlugin.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import proj4 from 'proj4'
22

3+
import { DISABLE_DRAWING_MENU_FOR_LEGACY_ON_HOSTNAMES } from '@/config'
34
import { transformLayerIntoUrlString } from '@/router/storeSync/LayerParamConfig.class'
45
import { LV95, WEBMERCATOR, WGS84 } from '@/utils/coordinates/coordinateSystems'
56
import CustomCoordinateSystem from '@/utils/coordinates/CustomCoordinateSystem.class'
@@ -144,6 +145,10 @@ const handleLegacyParams = (legacyParams, store, to, next) => {
144145
const { projection } = store.state.position
145146
let legacyCoordinates = []
146147
let latlongCoordinates = []
148+
// TODO BGDIINF_SB-2685: remove once legacy prod is decommissioned
149+
const isOnDevelopmentHost = DISABLE_DRAWING_MENU_FOR_LEGACY_ON_HOSTNAMES.some(
150+
(hostname) => hostname === store.state.ui.hostname
151+
)
147152

148153
Object.keys(legacyParams).forEach((param) => {
149154
handleLegacyParam(
@@ -177,11 +182,10 @@ const handleLegacyParams = (legacyParams, store, to, next) => {
177182
const urlWithoutQueryParam = window.location.href.substr(0, window.location.href.indexOf('?'))
178183
window.history.replaceState(window.history.state, document.title, urlWithoutQueryParam)
179184

180-
// TODO BGDIINF_SB-2685: re-activate once on prod
181-
// we cannot let adminId get through right now because legacy KML will be broken by the new viewer if edited
182-
// (broken in a sense that they will not be usable by mf-geoadmin3 anymore)
183-
const absolutelyNot = () => false
184-
if (absolutelyNot() && 'adminId' in legacyParams) {
185+
// TODO BGDIINF_SB-2685: remove dev host check when map.geo.admin.ch hosts web-mapviewer's code
186+
// we cannot let adminId get through right now (on our dev envs) because legacy KML will be broken by the
187+
// new viewer if edited (broken in a sense that they will not be usable by mf-geoadmin3 anymore)
188+
if (!isOnDevelopmentHost && 'adminId' in legacyParams) {
185189
// adminId legacy param cannot be handle above in the loop because it needs to add a layer
186190
// to the layers param, thats why we do handle after.
187191
handleLegacyKmlAdminIdParam(legacyParams, newQuery)

0 commit comments

Comments
 (0)