diff options
author | Merov Linden <merov@lindenlab.com> | 2014-08-22 00:18:00 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2014-08-22 00:18:00 -0700 |
commit | 6ab1e773d55b9dbe4a0af161ac194536a5892904 (patch) | |
tree | ed2b04c7898fb2516b511dc2d9a5f71da531016b | |
parent | 51e8b7fae6ff14c58bf32ef740a60386bc15baee (diff) |
DD-122 : WIP : Raise error when trying to list something that is empty or has empty stock folders.
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 29 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 35 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 2 |
3 files changed, 49 insertions, 17 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 51d1f088e0..60474dd125 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2983,17 +2983,21 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) } else if ("marketplace_list" == action) { - LLViewerInventoryCategory* cat = gInventory.getCategory(mUUID); - mMessage = ""; - if (!validate_marketplacelistings(cat,boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2))) - { - LLSD subs; - subs["[ERROR_CODE]"] = mMessage; - LLNotificationsUtil::add("MerchantListingFailed", subs); - } - else if (depth_nesting_in_marketplace(mUUID) == 1) + if (depth_nesting_in_marketplace(mUUID) == 1) { - LLMarketplaceData::instance().activateListing(mUUID,true); + LLUUID version_folder_id = LLMarketplaceData::instance().getVersionFolder(mUUID); + LLViewerInventoryCategory* cat = gInventory.getCategory(version_folder_id); + mMessage = ""; + if (!validate_marketplacelistings(cat,boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2))) + { + LLSD subs; + subs["[ERROR_CODE]"] = mMessage; + LLNotificationsUtil::add("MerchantListingFailed", subs); + } + else + { + LLMarketplaceData::instance().activateListing(mUUID,true); + } } return; } @@ -3090,7 +3094,10 @@ void LLFolderBridge::gatherMessage(std::string& message, LLError::ELevel log_lev { mMessage += "\n"; } - mMessage += message; + // Take the leading spaces out... + std::string::size_type start = message.find_first_not_of(" "); + // Append the message + mMessage += message.substr(start, message.length() - start); } } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 8ea8e5998e..59fdb19d90 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1454,17 +1454,40 @@ bool validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_ type = (LLInventoryType::EType)(i); } } - // If we have no items in there (only folders) -> all OK + // If we have no items in there (only folders or empty), analyze a bit further if (count == 0) { - // We warn if there's really nothing in the folder (may be it's a mistake or an under construction listing) - if ((cat_array->size() == 0) && cb) + if (cat_array->size() == 0) { - std::string message = indent + LLTrans::getString("Marketplace Validation Warning Empty") + cat->getName(); - cb(message,LLError::LEVEL_WARN); + // If this is an empty version folder (not even folders), raise an error + if (depth == 2) + { + result = false; + if (cb) + { + std::string message = indent + LLTrans::getString("Marketplace Validation Error Empty Version") + cat->getName(); + cb(message,LLError::LEVEL_ERROR); + } + } + // If this is a legit but empty stock folder, raise an error + else if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth > 2)) + { + result = false; + if (cb) + { + std::string message = indent + LLTrans::getString("Marketplace Validation Error Empty Stock") + cat->getName(); + cb(message,LLError::LEVEL_ERROR); + } + } + else if (cb) + { + // We warn if there's nothing in a regular folder (may be it's an under construction listing) + std::string message = indent + LLTrans::getString("Marketplace Validation Warning Empty") + cat->getName(); + cb(message,LLError::LEVEL_WARN); + } } } - // If we have one kind only, in the correct folder type at the right depth -> all OK + // If we have a single type of items of the right type in the right place, we're done else if ((count == 1) && (((type == LLInventoryType::IT_COUNT) && (depth > 1)) || ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth > 2)))) { // Done with that folder! diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 5fb964fba7..0b45a52899 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2301,6 +2301,8 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. <string name="Marketplace Validation Warning Move">Warning : moving item : </string> <string name="Marketplace Validation Warning Delete">Warning : folder content completely transfered to stock folder, removing empty folder : </string> <string name="Marketplace Validation Error">Error : </string> + <string name="Marketplace Validation Error Empty Version">Error : cannot list empty version folder : </string> + <string name="Marketplace Validation Error Empty Stock">Error : cannot list empty stock folder : </string> <string name="Marketplace Error None">No error</string> <string name="Marketplace Error Prefix">Error: </string> <string name="Marketplace Error Not Merchant">Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string> |