diff --git a/lib/actions/user.js b/lib/actions/user.js index 149d7cf9a..14287dec5 100644 --- a/lib/actions/user.js +++ b/lib/actions/user.js @@ -163,6 +163,22 @@ function convertRequestToSearch(config) { requestParameters = {} // Deprecated OTP1 } = tripRequest const { host, path } = config.api + + // FIXME: remove if OTP-UI no longer includes trailing bracket + // Don't use ?. syntax, fromPlace and toPlace need to be defined in order to be replaced. + if (otp2QueryParams.fromPlace && otp2QueryParams.fromPlace.endsWith('}')) { + otp2QueryParams.fromPlace = otp2QueryParams.fromPlace.substring( + 0, + otp2QueryParams.fromPlace.length - 2 + ) + } + if (otp2QueryParams.toPlace && otp2QueryParams.toPlace.endsWith('}')) { + otp2QueryParams.toPlace = otp2QueryParams.toPlace.substring( + 0, + otp2QueryParams.toPlace.length - 2 + ) + } + return { canDelete: false, id, diff --git a/lib/components/form/user-settings-i18n.js b/lib/components/form/user-settings-i18n.js index e6a89aa0d..246baea68 100644 --- a/lib/components/form/user-settings-i18n.js +++ b/lib/components/form/user-settings-i18n.js @@ -50,9 +50,12 @@ export function summarizeQuery(query, intl, locations = []) { ) } - const modes = query.modes - .map(({ mode, qualifier }) => `${mode}${qualifier ? `_${qualifier}` : ''}`) - .join(',') + const modes = + query.modes + ?.map( + ({ mode, qualifier }) => `${mode}${qualifier ? `_${qualifier}` : ''}` + ) + .join(',') || '' const from = findLocationType(intl, query.from, locations) || stripAllButNameOfAddress(query.from.name)