forked from MapComplete/MapComplete
		
	Fix changeset uploading
This commit is contained in:
		
							parent
							
								
									f2f2c01e48
								
							
						
					
					
						commit
						ae04047346
					
				
					 2 changed files with 19 additions and 2 deletions
				
			
		|  | @ -50,6 +50,22 @@ export class ChangesetHandler { | |||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Creates a new list which contains every key at most once | ||||
|      */ | ||||
|     public static removeDuplicateMetaTags(extraMetaTags: ChangesetTag[]): ChangesetTag[]{ | ||||
|         const r : ChangesetTag[] = [] | ||||
|         const seen = new Set<string>() | ||||
|         for (const extraMetaTag of extraMetaTags) { | ||||
|             if(seen.has(extraMetaTag.key)){ | ||||
|                 continue | ||||
|             } | ||||
|             r.push(extraMetaTag) | ||||
|             seen.add(extraMetaTag.key) | ||||
|         } | ||||
|         return r | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Inplace rewrite of extraMetaTags | ||||
|      * If the metatags contain a special motivation of the format "<change-type>:node/-<number>", this method will rewrite this negative number to the actual ID | ||||
|  | @ -95,7 +111,7 @@ export class ChangesetHandler { | |||
|         } | ||||
|          | ||||
|         extraMetaTags = [...extraMetaTags, ...this.defaultChangesetTags()] | ||||
| 
 | ||||
|         extraMetaTags = ChangesetHandler.removeDuplicateMetaTags(extraMetaTags) | ||||
|         if (this.userDetails.data.csCount == 0) { | ||||
|             // The user became a contributor!
 | ||||
|             this.userDetails.data.csCount = 1; | ||||
|  | @ -316,6 +332,7 @@ export class ChangesetHandler { | |||
|     private async UpdateTags( | ||||
|         csId: number, | ||||
|         tags: ChangesetTag[]) { | ||||
|         tags = ChangesetHandler.removeDuplicateMetaTags(tags) | ||||
| 
 | ||||
|         console.trace("Updating tags of " + csId) | ||||
|         const self = this; | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import {Utils} from "../Utils"; | |||
| 
 | ||||
| export default class Constants { | ||||
| 
 | ||||
|     public static vNumber = "0.16.7"; | ||||
|     public static vNumber = "0.16.8"; | ||||
|      | ||||
|     public static ImgurApiKey = '7070e7167f0a25a' | ||||
|     public static readonly mapillary_client_token_v4 = "MLY|4441509239301885|b40ad2d3ea105435bd40c7e76993ae85" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue