Fix: add check that no changeset is opened without actually having changes

This commit is contained in:
Pieter Vander Vennet 2023-10-05 16:05:57 +02:00
parent f2375f4877
commit 2843b01586

View file

@ -517,6 +517,17 @@ export class Changes {
...motivations, ...motivations,
...perBinMessage, ...perBinMessage,
] ]
{
const changes: {
newObjects: OsmObject[]
modifiedObjects: OsmObject[]
deletedObjects: OsmObject[]
} = self.CreateChangesetObjects(pending, objects);
if(changes.newObjects.length + changes.modifiedObjects.length + changes.deletedObjects.length === 0){
console.log("Not opening/uploading a changeset; seems like all changes are already applied")
return true
}
}
await this._changesetHandler.UploadChangeset( await this._changesetHandler.UploadChangeset(
(csId, remappings) => { (csId, remappings) => {
@ -525,11 +536,14 @@ export class Changes {
pending = pending.map((ch) => ChangeDescriptionTools.rewriteIds(ch, remappings)) pending = pending.map((ch) => ChangeDescriptionTools.rewriteIds(ch, remappings))
console.log("Result is", pending) console.log("Result is", pending)
} }
const changes: { const changes: {
newObjects: OsmObject[] newObjects: OsmObject[]
modifiedObjects: OsmObject[] modifiedObjects: OsmObject[]
deletedObjects: OsmObject[] deletedObjects: OsmObject[]
} = self.CreateChangesetObjects(pending, objects) } = self.CreateChangesetObjects(pending, objects)
return Changes.createChangesetFor("" + csId, changes) return Changes.createChangesetFor("" + csId, changes)
}, },
metatags, metatags,