Skip to content

Commit

Permalink
Fix changeset uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
pietervdvn committed Mar 15, 2022
1 parent f2f2c01 commit ae04047
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion Logic/Osm/ChangesetHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Models/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ae04047

Please sign in to comment.