Properly handle case sensitive tags in taginfo suggestion in raw tag editor, fixes #9640

This commit is contained in:
Martin Raifer
2023-05-16 17:06:39 +02:00
parent a35653d35d
commit 9779f320a8
4 changed files with 10 additions and 3 deletions
+2
View File
@@ -47,6 +47,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Fix a bug where the _Add_ input element on comboboxes with a fixed set of allowed options is still hidden after an option of a previously "fully saturated" field is removed
* Fix wrongly flagged "incorrect geometry type" warnings for features with lifecycle-prefixed tags ([#9483], thanks [@biswajit-k])
* Fix corruption of tag values of fields with referenced strings, but restricted `options`, when an unavailable option is entered manually into the field.
* Properly handle case sensitive tag values in taginfo suggestions in raw tag editor ([#9640])
#### :earth_asia: Localization
* Send `Accept-Language` header on Nominatim API calls ([#9501], thanks [@k-yle])
* Add Address and Phone Format for India ([#9482], thanks [@biswajit-k])
@@ -67,6 +68,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#9493]: https://github.com/openstreetmap/iD/pull/9493
[#9520]: https://github.com/openstreetmap/iD/pull/9520
[#9501]: https://github.com/openstreetmap/iD/pull/9501
[#9640]: https://github.com/openstreetmap/iD/issues/9640
[@biswajit-k]: https://github.com/biswajit-k
+3
View File
@@ -242,3 +242,6 @@ export var osmRailwayTrackTagValues = {
export var osmFlowingWaterwayTagValues = {
canal: true, ditch: true, drain: true, fish_pass: true, river: true, stream: true, tidal_channel: true
};
// Tags which values should be considered case sensitive when offering tag suggestions
export const allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
+2 -2
View File
@@ -4,6 +4,7 @@ import { json as d3_json } from 'd3-fetch';
import { utilObjectOmit, utilQsString } from '../util';
import { localizer } from '../core/localizer';
import { allowUpperCaseTagValues } from '../osm/tags';
import { taginfoApiUrl } from '../../config/id.js';
@@ -312,8 +313,7 @@ export default {
// A few OSM keys expect values to contain uppercase values (see #3377).
// This is not an exhaustive list (e.g. `name` also has uppercase values)
// but these are the fields where taginfo value lookup is most useful.
var re = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale/;
var allowUpperCase = re.test(params.key);
var allowUpperCase = allowUpperCaseTagValues.test(params.key);
var f = filterValues(allowUpperCase);
var result = d.data.filter(f).map(valKeyDescription);
+3 -1
View File
@@ -11,6 +11,7 @@ import { localizer, t } from '../../core/localizer';
import { utilArrayDifference, utilArrayIdentical } from '../../util/array';
import { utilGetSetValue, utilNoAuto, utilRebind, utilTagDiff } from '../../util';
import { uiTooltip } from '..';
import { allowUpperCaseTagValues } from '../../osm/tags';
export function uiSectionRawTagEditor(id, context) {
@@ -437,7 +438,8 @@ export function uiSectionRawTagEditor(id, context) {
}, function(err, data) {
if (!err) callback(sort(value, data));
});
}));
})
.caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
function sort(value, data) {