diff --git a/editor/server_api.cpp b/editor/server_api.cpp index f20ce26394..650d3116b7 100644 --- a/editor/server_api.cpp +++ b/editor/server_api.cpp @@ -121,7 +121,7 @@ void ServerApi06::CloseChangeSet(uint64_t changesetId) const uint64_t ServerApi06::CreateNote(ms::LatLon const & ll, string const & message) const { CHECK(!message.empty(), ("Note content should not be empty.")); - string const params = "?lat=" + strings::to_string_dac(ll.lat, 7) + "&lon=" + strings::to_string_dac(ll.lon, 7) + "&text=" + UrlEncode(message + " #mapsme"); + string const params = "?lat=" + strings::to_string_dac(ll.lat, 7) + "&lon=" + strings::to_string_dac(ll.lon, 7) + "&text=" + UrlEncode(message); OsmOAuth::Response const response = m_auth.Request("/notes" + params, "POST"); if (response.first != OsmOAuth::HTTP::OK) MYTHROW(ErrorAddingNote, ("Could not post a new note:", response)); diff --git a/indexer/osm_editor.cpp b/indexer/osm_editor.cpp index b90dccd4c2..42ece682a6 100644 --- a/indexer/osm_editor.cpp +++ b/indexer/osm_editor.cpp @@ -915,9 +915,13 @@ bool Editor::CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::Mwm return true; } -void Editor::CreateNote(ms::LatLon const & latLon, string const & note) +void Editor::CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note) { - m_notes->CreateNote(latLon, note); + auto const version = GetMwmCreationTimeByMwmId(fid.m_mwmId); + auto const stringVersion = my::TimestampToString(my::SecondsSinceEpochToTimeT(version)); + ostringstream sstr(note, ios_base::ate); + sstr << " #mapsme: OSM snapshot version: " << stringVersion; + m_notes->CreateNote(latLon, sstr.str()); } void Editor::UploadNotes(string const & key, string const & secret) @@ -936,4 +940,6 @@ string DebugPrint(Editor::FeatureStatus fs) case Editor::FeatureStatus::Created: return "Created"; }; } + +char const * const Editor::kPlaceDoesNotExistMessage = "The place has gone or never existed. This is an auto-generated note from MAPS.ME application: a user reports a POI that is visible on a map (which can be outdated), but cannot be found on the ground."; } // namespace osm diff --git a/indexer/osm_editor.hpp b/indexer/osm_editor.hpp index f73df79d63..dbd5c27796 100644 --- a/indexer/osm_editor.hpp +++ b/indexer/osm_editor.hpp @@ -114,9 +114,13 @@ public: // Editor should silently ignore all types in config which are unknown to him. NewFeatureCategories GetNewFeatureCategories() const; - bool CreatePoint(uint32_t type, m2::PointD const & mercator, MwmSet::MwmId const & id, EditableMapObject & outFeature); + bool CreatePoint(uint32_t type, m2::PointD const & mercator, + MwmSet::MwmId const & id, EditableMapObject & outFeature); - void CreateNote(ms::LatLon const & latLon, string const & note); + // Predefined messages. + static const char * const kPlaceDoesNotExistMessage; + + void CreateNote(ms::LatLon const & latLon, FeatureID const & fid, string const & note); void UploadNotes(string const & key, string const & secret); struct Stats diff --git a/iphone/Maps/Classes/MWMReportBaseController.mm b/iphone/Maps/Classes/MWMReportBaseController.mm index 8c74c2bff3..9dfb59e403 100644 --- a/iphone/Maps/Classes/MWMReportBaseController.mm +++ b/iphone/Maps/Classes/MWMReportBaseController.mm @@ -30,7 +30,7 @@ NSAssert(!note.empty(), @"String can't be empty!"); auto const & featureID = MapsAppDelegate.theApp.mapViewController.controlsManager.placePageEntity.info.GetID(); auto const latLon = ToLatLon(m_point); - osm::Editor::Instance().CreateNote(latLon, note); + osm::Editor::Instance().CreateNote(latLon, featureID, note); [Statistics logEvent:kStatEditorProblemReport withParameters:@{kStatEditorMWMName : @(featureID.GetMwmName().c_str()), kStatEditorMWMVersion : @(featureID.GetMwmVersion()), kStatProblem : @(note.c_str()), diff --git a/iphone/Maps/Classes/MWMReportProblemController.mm b/iphone/Maps/Classes/MWMReportProblemController.mm index e39b6219b6..32cd7086f6 100644 --- a/iphone/Maps/Classes/MWMReportProblemController.mm +++ b/iphone/Maps/Classes/MWMReportProblemController.mm @@ -1,10 +1,7 @@ #import "MWMReportProblemController.h" #import "SelectableCell.h" -namespace -{ - string const kAmenityDoesntExist = "The amenity has gone or never existed. This is an auto-generated note from MAPS.ME application: a user reports a POI that is visible on a map (which can be a month old), but cannot be found on the ground."; -} +#include "indexer/osm_editor.hpp" @interface MWMReportProblemController () @@ -32,7 +29,7 @@ namespace { if (!self.isCellSelected) return; - [self sendNote:kAmenityDoesntExist]; + [self sendNote:osm::Editor::kPlaceDoesNotExistMessage]; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender