mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-04 14:08:13 +02:00
Change autofix to accept arguments to perform, implement "fix all"
This commit is contained in:
@@ -34,26 +34,23 @@ export function validationOldMultipolygon() {
|
||||
entities: [outerWay, multipolygon],
|
||||
fixes: [
|
||||
new validationIssueFix({
|
||||
auto: true,
|
||||
autoArgs: [doUpgrade, t('issues.fix.move_tags.annotation')],
|
||||
title: t('issues.fix.move_tags.title'),
|
||||
onClick: function() {
|
||||
var outerWay = this.issue.entities[0];
|
||||
var multipolygon = this.issue.entities[1];
|
||||
context.perform(
|
||||
function(graph) {
|
||||
multipolygon = multipolygon.mergeTags(outerWay.tags);
|
||||
graph = graph.replace(multipolygon);
|
||||
graph = actionChangeTags(outerWay.id, {})(graph);
|
||||
return graph;
|
||||
},
|
||||
t('issues.fix.move_tags.annotation')
|
||||
);
|
||||
context.perform(doUpgrade, t('issues.fix.move_tags.annotation'));
|
||||
}
|
||||
})
|
||||
]
|
||||
})];
|
||||
|
||||
|
||||
function doUpgrade(graph) {
|
||||
multipolygon = multipolygon.mergeTags(outerWay.tags);
|
||||
graph = graph.replace(multipolygon);
|
||||
return actionChangeTags(outerWay.id, {})(graph);
|
||||
}
|
||||
|
||||
|
||||
function showReference(selection) {
|
||||
selection.selectAll('.issue-reference')
|
||||
.data([0])
|
||||
|
||||
@@ -63,26 +63,23 @@ export function validationOutdatedTags() {
|
||||
message: t('issues.outdated_tags.message', { feature: utilDisplayLabel(entity, context) }),
|
||||
reference: showReference,
|
||||
entities: [entity],
|
||||
data: {
|
||||
newTags: newTags
|
||||
},
|
||||
fixes: [
|
||||
new validationIssueFix({
|
||||
auto: true,
|
||||
autoArgs: [doUpgrade, t('issues.fix.upgrade_tags.annotation')],
|
||||
title: t('issues.fix.upgrade_tags.title'),
|
||||
onClick: function() {
|
||||
var entityID = this.issue.entities[0].id;
|
||||
var newTags = this.issue.data.newTags;
|
||||
context.perform(
|
||||
actionChangeTags(entityID, newTags),
|
||||
t('issues.fix.upgrade_tags.annotation')
|
||||
);
|
||||
context.perform(doUpgrade, t('issues.fix.upgrade_tags.annotation'));
|
||||
}
|
||||
})
|
||||
]
|
||||
})];
|
||||
|
||||
|
||||
function doUpgrade(graph) {
|
||||
return actionChangeTags(entity.id, newTags)(graph);
|
||||
}
|
||||
|
||||
|
||||
function showReference(selection) {
|
||||
var enter = selection.selectAll('.issue-reference')
|
||||
.data([0])
|
||||
|
||||
Reference in New Issue
Block a user