Handle updating OSM object wikidata tag

This commit is contained in:
Edward Betts 2021-10-22 11:50:25 +01:00
parent fd496be2ff
commit d37a177d38

View file

@ -225,7 +225,12 @@
<br> <br>
<span v-if="osm.selected"> <span v-if="osm.selected">
add tag: <span class="badge bg-success">wikidata={{ edit.qid }}</span> <span v-if="osm.tags.wikidata !== undefined">
update tag: <span class="badge bg-success">wikidata={{ edit.qid }}</span>
</span>
<span v-else>
add tag: <span class="badge bg-success">wikidata={{ edit.qid }}</span>
</span>
</span> </span>
<span v-else> <span v-else>
remove tag: <span class="badge bg-danger">wikidata={{ edit.qid }}</span> remove tag: <span class="badge bg-danger">wikidata={{ edit.qid }}</span>
@ -1031,11 +1036,21 @@ export default {
this.upload_state = "init"; this.upload_state = "init";
var edit_list = []; var edit_list = [];
this.edits.forEach((edit) => { this.edits.forEach((edit) => {
var qid = edit.item.qid;
var osm = edit.osm;
var e = { var e = {
'qid': edit.item.qid, 'qid': qid,
'osm': edit.osm.identifier, 'osm': osm.identifier,
'op': (edit.osm.selected ? 'add' : 'remove'),
}; };
if (osm.selected) {
if (osm.tags.wikidata !== undefined && osm.tags.wikidata != qid) {
e['op'] = 'change';
} else {
e['op'] = 'add';
}
} else {
e['op'] = 'remove';
}
edit_list.push(e); edit_list.push(e);
}); });
var post_json = { var post_json = {