Fix ImproveOSM request payload

- Seems that the expected payload has changed so now all error types use
key "targetIds"
- Also includes minor fix so that comments display in the UI immediately
This commit is contained in:
SilentSpike
2020-01-03 19:48:13 +00:00
parent fa2b8913c2
commit 820e86ad6c
+5 -12
View File
@@ -361,9 +361,10 @@ export default {
var that = this;
d3_json(url)
.then(function(data) {
// Assign directly for immediate use in the callback
// comments are served newest to oldest
var comments = data.comments ? data.comments.reverse() : [];
that.replaceError(d.update({ comments: comments }));
d.comments = data.comments ? data.comments.reverse() : [];
that.replaceError(d);
if (callback) callback(null, d);
})
.catch(function(err) {
@@ -390,18 +391,10 @@ export default {
var key = d.error_key;
var url = _impOsmUrls[key] + '/comment';
var payload = {
username: user.display_name
username: user.display_name,
targetIds: [ d.identifier ]
};
// Each error type has different data for identification
if (key === 'ow') {
payload.roadSegments = [ d.identifier ];
} else if (key === 'mr') {
payload.tiles = [ d.identifier ];
} else if (key === 'tr') {
payload.targetIds = [ d.identifier ];
}
if (d.newStatus !== undefined) {
payload.status = d.newStatus;
payload.text = 'status changed';