Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/components/form/user-settings-i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ function findLocationType(
? getFormattedPlaces(match.type, intl)
: null
}
function findCustomLocationShortName(location, locations = []) {
const match = locations.find((l) => matchLatLon(l, location))
return match && (match.type === 'custom' || match.type === 'dining')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Try excluding "Home" and "Work" instead?

? `${match.name} (${stripAllButNameOfAddress(match.address)})`
: null
}
export function summarizeQuery(query, intl, locations = []) {
if (!query.from.name) {
query.from.name = intl.formatMessage(
Expand All @@ -58,9 +64,11 @@ export function summarizeQuery(query, intl, locations = []) {
.join(',') || ''
const from =
findLocationType(intl, query.from, locations) ||
findCustomLocationShortName(query.from, locations) ||
stripAllButNameOfAddress(query.from.name)
const to =
findLocationType(intl, query.to, locations) ||
findCustomLocationShortName(query.to, locations) ||
stripAllButNameOfAddress(query.to.name)
const mode = hasTransit(modes)
? intl.formatMessage({ id: 'common.modes.transit' })
Expand Down
Loading