First guess on how to deal with place

Fall back to host when there is no place.  Probably better ideas, like
specify the name and the type (a place, a domain if no place, etc...)
will come soon.
This commit is contained in:
David Kelly 2016-08-09 13:42:48 -07:00
parent c8f3a898d2
commit 8457acd234

View file

@ -188,12 +188,17 @@ void SnapshotUploader::uploadSuccess(QNetworkReply& reply) {
QJsonParseError jsonError;
auto doc = QJsonDocument::fromJson(contents, &jsonError);
if (jsonError.error == QJsonParseError::NoError) {
QString thumbnail_url = doc.object().value("thumbnail_url").toString();
QString thumbnailUrl = doc.object().value("thumbnail_url").toString();
QString placeName = DependencyManager::get<AddressManager>()->getPlaceName();
if(placeName.isEmpty()) {
placeName = DependencyManager::get<AddressManager>()->getHost();
}
// create json post data
QJsonObject rootObject;
QJsonObject userStoryObject;
userStoryObject.insert("thumbnail_url", thumbnail_url);
userStoryObject.insert("thumbnail_url", thumbnailUrl);
userStoryObject.insert("place_name", placeName);
userStoryObject.insert("action", "snapshot");
rootObject.insert("user_story", userStoryObject);