forked from MapComplete/MapComplete
Allow to delete freeform keys again, partial fix of #2008
This commit is contained in:
parent
4df2d34f02
commit
d8da61ec07
5 changed files with 56 additions and 17 deletions
|
|
@ -133,7 +133,16 @@ export interface MappingConfigJson {
|
|||
* question: What extra tags should be added to the object if this object is chosen?
|
||||
* type: simple_tag
|
||||
*
|
||||
* If chosen as answer, these tags will be applied onto the object, together with the tags from the `if`
|
||||
* If chosen as answer, these tags will be applied onto the object, together with the tags from the `if`.
|
||||
* Note that if the contributor picks this mapping, saves and then changes their mind and uses a different mapping,
|
||||
* the extraTags will reside.
|
||||
* E.g. when picking `memorial:type=bench`, then `amenity=bench` will also be applied.
|
||||
* If someone later on changes the type to `memorial:statue`, `amenity=bench` will stay onto the object
|
||||
* (which is the desired behaviour, see e.g. for https://www.openstreetmap.org/node/5620038478)
|
||||
* Use 'ifNot' to explicitly remove an tag if this is important
|
||||
*
|
||||
* If someone marks the question as 'unknown', the extra tags will not be erased
|
||||
*
|
||||
* Not compatible with multiAnswer.
|
||||
*
|
||||
* This can be used e.g. to erase other keys which indicate the 'not' value:
|
||||
|
|
|
|||
|
|
@ -911,6 +911,24 @@ export default class TagRenderingConfig {
|
|||
|
||||
return Utils.NoNull(tags)
|
||||
}
|
||||
|
||||
/**
|
||||
* The keys that should be erased if one has to revert to 'unknown'.
|
||||
* Might give undefined
|
||||
*/
|
||||
public settableKeys(): string[] | undefined {
|
||||
const toDelete = new Set<string>()
|
||||
if(this.freeform){
|
||||
toDelete.add(this.freeform.key)
|
||||
}
|
||||
for (const mapping of this.mappings) {
|
||||
for (const usedKey of mapping.if.usedKeys()) {
|
||||
toDelete.add(usedKey)
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(toDelete)
|
||||
}
|
||||
}
|
||||
|
||||
export class TagRenderingConfigUtils {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue