Simplify handling of id rewrites by centralizing them to the changesethandler (which improves testability too), fixes a part of #564

This commit is contained in:
Pieter Vander Vennet 2022-04-08 04:18:53 +02:00
parent c3f3f69c3b
commit 9238f0f381
7 changed files with 232 additions and 96 deletions

View file

@ -51,22 +51,6 @@ export default class CreateNewNodeAction extends OsmCreateAction {
}
}
public static registerIdRewrites(mappings: Map<string, string>) {
const toAdd: [string, number][] = []
this.previouslyCreatedPoints.forEach((oldId, key) => {
if (!mappings.has("node/" + oldId)) {
return;
}
const newId = Number(mappings.get("node/" + oldId).substr("node/".length))
toAdd.push([key, newId])
})
for (const [key, newId] of toAdd) {
CreateNewNodeAction.previouslyCreatedPoints.set(key, newId)
}
}
async CreateChangeDescriptions(changes: Changes): Promise<ChangeDescription[]> {
if (this._reusePreviouslyCreatedPoint) {