From 28bb12b7aef0793b112db7ce309b54a8b2e69f17 Mon Sep 17 00:00:00 2001 From: SilentSpike Date: Tue, 5 Feb 2019 19:31:30 +0000 Subject: [PATCH] Add function to retrieve ImproveOSM comments Just need to have the UI make this call and use the data next. --- modules/services/improveOSM.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/modules/services/improveOSM.js b/modules/services/improveOSM.js index 6f7f47e03..b688a2f72 100644 --- a/modules/services/improveOSM.js +++ b/modules/services/improveOSM.js @@ -329,6 +329,29 @@ export default { }); }, + // Test case: + // http://missingroads.skobbler.net/missingGeoService/retrieveComments?tileX=137495&tileY=89379 + getComments: function(d, callback) { + var key = d.error_key; + var qParams = {}; + + if (key === 'ow') { + qParams = d.identifier; + } else if (key === 'mr') { + qParams.tileX = d.identifier.x; + qParams.tileY = d.identifier.y; + } else if (key === 'tr') { + qParams.targetId = d.identifier; + } + + var url = _impOsmUrls[key] + '/retrieveComments?' + utilQsString(qParams); + + d3_json(url, function(err, data) { + d.comments = data.comments; + return callback(err, d); + }); + }, + postUpdate: function(d, callback) { if (!services.osm.authenticated()) { // Username required in payload return callback({ message: 'Not Authenticated', status: -3}, d);