From 5ba7054c6b912fc8981192e2337f14fcd6fe1a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 3 Oct 2014 12:48:15 +0200 Subject: [PATCH] HaikuDepot: Don't try to send "unspecified" stability Set to empty string and cause the JSON to have null. Fixes sending/editing comments without specifying a stability rating. --- src/apps/haikudepot/model/WebAppInterface.cpp | 4 ++-- src/apps/haikudepot/ui/RatePackageWindow.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/apps/haikudepot/model/WebAppInterface.cpp b/src/apps/haikudepot/model/WebAppInterface.cpp index 0fb21f42df..39b7b83aa0 100644 --- a/src/apps/haikudepot/model/WebAppInterface.cpp +++ b/src/apps/haikudepot/model/WebAppInterface.cpp @@ -471,7 +471,7 @@ WebAppInterface::CreateUserRating(const BString& packageName, .AddValue("pkgVersionType", "LATEST") .AddValue("userNickname", fUsername) .AddValue("rating", rating) - .AddValue("userRatingStabilityCode", stability) + .AddValue("userRatingStabilityCode", stability, true) .AddValue("comment", comment) .AddValue("naturalLanguageCode", languageCode) .EndObject() @@ -496,7 +496,7 @@ WebAppInterface::UpdateUserRating(const BString& ratingID, .AddObject() .AddValue("code", ratingID) .AddValue("rating", rating) - .AddValue("userRatingStabilityCode", stability) + .AddValue("userRatingStabilityCode", stability, true) .AddValue("comment", comment) .AddValue("naturalLanguageCode", languageCode) .AddValue("active", active) diff --git a/src/apps/haikudepot/ui/RatePackageWindow.cpp b/src/apps/haikudepot/ui/RatePackageWindow.cpp index 2f7b908b13..f9b118d89b 100644 --- a/src/apps/haikudepot/ui/RatePackageWindow.cpp +++ b/src/apps/haikudepot/ui/RatePackageWindow.cpp @@ -427,7 +427,7 @@ RatePackageWindow::_QueryRatingThread() } if (result.FindString("userRatingStabilityCode", &fStability) == B_OK) { - int32 index = -1; + int32 index = 0; for (int32 i = fStabilityCodes.CountItems() - 1; i >= 0; i--) { const StabilityRating& stability = fStabilityCodes.ItemAtFast(i); @@ -493,6 +493,9 @@ RatePackageWindow::_SendRatingThread() Unlock(); + if (stability == "unspecified") + stability = ""; + status_t status; BMessage info; if (ratingID.Length() > 0) {