From c3bb0cb83787c299ee4a92e8df6046aa448d77c8 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 13 Sep 2024 20:37:14 +0200 Subject: [PATCH] Fix: nobrand= is actually applied when using the Name suggestion index --- src/Models/ThemeConfig/TagRenderingConfig.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Models/ThemeConfig/TagRenderingConfig.ts b/src/Models/ThemeConfig/TagRenderingConfig.ts index e2a4c1538d..153abe36c8 100644 --- a/src/Models/ThemeConfig/TagRenderingConfig.ts +++ b/src/Models/ThemeConfig/TagRenderingConfig.ts @@ -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[] | undefined { - if(!partOfLayer?.source || !currentTags){ + if (!partOfLayer?.source || !currentTags) { return } const toDelete = new Set() @@ -1001,12 +1001,17 @@ export class TagRenderingConfigUtils { // The original mappings get "priorityIf" set const oldMappingsCloned = clone.mappings?.map( - (m) => - { + (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 + }, ) ?? [] clone.mappings = [...oldMappingsCloned, ...extraMappings] return clone