When adding not:* tag, remove the old wikipedia and wikidata tags

This commit is contained in:
Bryan Housel
2021-08-07 00:42:07 -04:00
parent 97ddf125d2
commit 0db99fe530
+10 -2
View File
@@ -161,8 +161,16 @@ export function validationOutdatedTags() {
if (!item) return graph;
let newTags = Object.assign({}, currEntity.tags); // shallow copy
const k = `not:${item.mainTag}`;
newTags[k] = item.tags[item.mainTag];
const wd = item.mainTag; // e.g. `brand:wikidata`
const notwd = `not:${wd}`; // e.g. `not:brand:wikidata`
const qid = item.tags[wd];
newTags[notwd] = qid;
if (newTags[wd] === qid) { // if `brand:wikidata` was set to that qid
const wp = item.mainTag.replace('wikidata', 'wikipedia');
delete newTags[wd]; // remove `brand:wikidata`
delete newTags[wp]; // remove `brand:wikipedia`
}
return actionChangeTags(currEntity.id, newTags)(graph);
}