diff --git a/Logic/Osm/ChangesetHandler.ts b/Logic/Osm/ChangesetHandler.ts index 5b07a0faf..1861afa3a 100644 --- a/Logic/Osm/ChangesetHandler.ts +++ b/Logic/Osm/ChangesetHandler.ts @@ -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() + 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 ":node/-", 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; diff --git a/Models/Constants.ts b/Models/Constants.ts index a1b3e2605..bba84fb33 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -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"