Fixed an bug where the wrong feature could be deleted from the untagged feature issue fix

This commit is contained in:
Quincy Morgan
2018-12-21 14:00:08 -05:00
parent c9350c632e
commit 627b4ee732
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ export function uiEntityIssues(context) {
.text(function(d) {
return d.title;
})
.on('click', function(d){
.on('click', function(d) {
d.action()
});
}
+2 -1
View File
@@ -42,7 +42,8 @@ export function validationMissingTag(context) {
new validationIssueFix({
title: t('issues.fix.delete_feature.title'),
action: function() {
operationDelete([change.id], context)();
var id = this.issue.entities[0].id;
operationDelete([id], context)();
}
}),
new validationIssueFix({
+9
View File
@@ -44,6 +44,13 @@ export function validationIssue(attrs) {
this.entities = attrs.entities; // expect an array of entities
this.coordinates = attrs.coordinates; // expect a [lon, lat] array
this.fixes = attrs.fixes; // expect an array of functions for possible fixes
if (this.fixes) {
for (var i=0; i<this.fixes.length; i++) {
// add a reference in the fix to the issue for use in fix actions
this.fixes[i].issue = this;
}
}
}
export function validationIssueFix(attrs) {
@@ -51,4 +58,6 @@ export function validationIssueFix(attrs) {
this.title = attrs.title;
this.action = attrs.action;
// the issue this fix is for
this.issue = null;
}