forked from MapComplete/MapComplete
		
	Fix: add check that no changeset is opened without actually having changes
This commit is contained in:
		
							parent
							
								
									f2375f4877
								
							
						
					
					
						commit
						2843b01586
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -517,6 +517,17 @@ export class Changes {
 | 
			
		|||
            ...motivations,
 | 
			
		||||
            ...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(
 | 
			
		||||
            (csId, remappings) => {
 | 
			
		||||
| 
						 | 
				
			
			@ -525,11 +536,14 @@ export class Changes {
 | 
			
		|||
                    pending = pending.map((ch) => ChangeDescriptionTools.rewriteIds(ch, remappings))
 | 
			
		||||
                    console.log("Result is", pending)
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                const changes: {
 | 
			
		||||
                    newObjects: OsmObject[]
 | 
			
		||||
                    modifiedObjects: OsmObject[]
 | 
			
		||||
                    deletedObjects: OsmObject[]
 | 
			
		||||
                } = self.CreateChangesetObjects(pending, objects)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                return Changes.createChangesetFor("" + csId, changes)
 | 
			
		||||
            },
 | 
			
		||||
            metatags,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue