Fix: nobrand= is actually applied when using the Name suggestion index

This commit is contained in:
Pieter Vander Vennet 2024-09-13 20:37:14 +02:00
parent 89a20ca1af
commit c3bb0cb837

View file

@ -926,7 +926,7 @@ export default class TagRenderingConfig {
* Might give undefined if setting to unknown is not possible
*/
public removeToSetUnknown(partOfLayer: LayerConfig, currentTags: Record<string, string>): string[] | undefined {
if(!partOfLayer?.source || !currentTags){
if (!partOfLayer?.source || !currentTags) {
return
}
const toDelete = new Set<string>()
@ -1001,12 +1001,17 @@ export class TagRenderingConfigUtils {
// The original mappings get "priorityIf" set
const oldMappingsCloned =
clone.mappings?.map(
(m) =>
<Mapping>{
(m) => {
const mapping = {
...m,
addExtraTags: [new Tag("nobrand", "")],
priorityIf: m.priorityIf ?? TagUtils.Tag("id~*"),
},
}
if (m.if.usedKeys().indexOf("nobrand") < 0) {
// Erase 'nobrand=yes', unless this option explicitly sets it
mapping["addExtraTags"] = [new Tag("nobrand", "")]
}
return <Mapping>mapping
},
) ?? []
clone.mappings = [...oldMappingsCloned, ...extraMappings]
return clone