Fix notification bugs, sync with upstream, yaaay
This commit is contained in:
@@ -3053,7 +3053,17 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
|
||||
if (depth_nesting_in_marketplace(mUUID) == 2)
|
||||
{
|
||||
LLInventoryCategory* category = gInventory.getCategory(mUUID);
|
||||
LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), mUUID);
|
||||
mMessage = "";
|
||||
if (!validate_marketplacelistings(category,boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3),false,2))
|
||||
{
|
||||
LLSD subs;
|
||||
subs["[ERROR_CODE]"] = mMessage;
|
||||
LLNotificationsUtil::add("MerchantFolderActivationFailed", subs);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), mUUID);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,11 +148,13 @@ LLUUID getVersionFolderIfUnique(const LLUUID& folder_id)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// SLM Responders
|
||||
void log_SLM_warning(const std::string& request, U32 status, const std::string& reason, const std::string& code, const std::string& description)
|
||||
// SLM Reporters
|
||||
void log_SLM_warning(const std::string& request, U32 status, const std::string& reason, const std::string& code, const LLSD& content)
|
||||
{
|
||||
LL_WARNS("SLM") << "SLM API : Responder to " << request << ". status : " << status << ", reason : " << reason << ", code : " << code << ", description : " << description << LL_ENDL;
|
||||
if ((status == 422) && (description == "[\"You must have an English description to list the product\", \"You must choose a category for your product before it can be listed\", \"Listing could not change state.\", \"Price can't be blank\"]"))
|
||||
LL_WARNS("SLM") << "SLM API : Responder to " << request << ". status : " << status << ", reason : " << reason << ", code : " << code << ", description : " << ll_pretty_print_sd(content) << LL_ENDL;
|
||||
if ((status == 422) &&
|
||||
content.isArray() &&
|
||||
content.size() > 4)
|
||||
{
|
||||
// Unprocessable Entity : Special case that error as it is a frequent answer when trying to list an incomplete listing
|
||||
LLNotificationsUtil::add("MerchantUnprocessableEntity");
|
||||
@@ -161,9 +163,34 @@ void log_SLM_warning(const std::string& request, U32 status, const std::string&
|
||||
{
|
||||
// Prompt the user with the warning (so they know why things are failing)
|
||||
LLSD subs;
|
||||
subs["[ERROR_REASON]"] = reason;
|
||||
// We do show long descriptions in the alert (unlikely to be readable). The description string will be in the log though.
|
||||
subs["[ERROR_DESCRIPTION]"] = (description.length() <= 512 ? description : LLStringUtil::null);
|
||||
std::string description;
|
||||
{
|
||||
if (content.isArray())
|
||||
{
|
||||
for (auto it = content.beginArray(); it != content.endArray(); ++it)
|
||||
{
|
||||
if (!description.empty())
|
||||
description += '\n';
|
||||
description += (*it).asString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
description = content.asString();
|
||||
}
|
||||
}
|
||||
std::string reason_lc = reason;
|
||||
LLStringUtil::toLower(reason_lc);
|
||||
if (!description.empty() && reason_lc.find("unknown") != std::string::npos)
|
||||
{
|
||||
subs["[ERROR_REASON]"] = LLStringUtil::null;
|
||||
}
|
||||
else
|
||||
{
|
||||
subs["[ERROR_REASON]"] = '\'' + reason +"'\n";
|
||||
}
|
||||
subs["[ERROR_DESCRIPTION]"] = description;
|
||||
LLNotificationsUtil::add("MerchantTransactionFailed", subs);
|
||||
}
|
||||
}
|
||||
@@ -220,7 +247,7 @@ protected:
|
||||
}
|
||||
else
|
||||
{
|
||||
log_SLM_warning("Get /merchant", httpCode, getReason(), getContent().get("error_code"), getContent().get("error_description"));
|
||||
log_SLM_warning("Get /merchant", httpCode, getReason(), LLStringUtil::null, getContent());
|
||||
LLMarketplaceData::instance().
|
||||
setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_CONNECTION_FAILURE);
|
||||
}
|
||||
@@ -254,9 +281,12 @@ public:
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
log_SLM_warning("Get /listings", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Get /listings", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
LLMarketplaceData::instance().
|
||||
setSLMDataFetched(MarketplaceFetchCodes::MARKET_FETCH_FAILED);
|
||||
update_marketplace_category(folderId, false);
|
||||
@@ -266,9 +296,6 @@ public:
|
||||
|
||||
log_SLM_infos("Get /listings", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
// Extract the info from the results
|
||||
for (LLSD::array_iterator it = result["listings"].beginArray();
|
||||
it != result["listings"].endArray(); ++it)
|
||||
@@ -315,14 +342,15 @@ public:
|
||||
{
|
||||
LLMarketplaceData::instance().setUpdating(folderId, false);
|
||||
|
||||
LLBufferStream istr(channels, buffer.get());
|
||||
std::stringstream strstrm;
|
||||
strstrm << istr.rdbuf();
|
||||
const std::string body = strstrm.str();
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
log_SLM_warning("Post /listings", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Post /listings", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
update_marketplace_category(folderId, false);
|
||||
gInventory.notifyObservers();
|
||||
return;
|
||||
@@ -330,9 +358,6 @@ public:
|
||||
|
||||
log_SLM_infos("Post /listings", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
// Extract the info from the Json string
|
||||
auto it = result["listings"].beginArray();
|
||||
|
||||
@@ -379,6 +404,9 @@ public:
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
if (getStatus() == HTTP_NOT_FOUND)
|
||||
@@ -389,7 +417,7 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
log_SLM_warning("Get /listing", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Get /listing", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
}
|
||||
update_marketplace_category(folderId, false);
|
||||
gInventory.notifyObservers();
|
||||
@@ -398,9 +426,6 @@ public:
|
||||
|
||||
log_SLM_infos("Get /listing", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
// Extract the info from the results
|
||||
for (LLSD::array_iterator it = result["listings"].beginArray();
|
||||
it != result["listings"].endArray(); ++it)
|
||||
@@ -455,9 +480,12 @@ public:
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
log_SLM_warning("Put /listing", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Put /listing", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
update_marketplace_category(folderId, false);
|
||||
gInventory.notifyObservers();
|
||||
return;
|
||||
@@ -465,9 +493,6 @@ public:
|
||||
|
||||
log_SLM_infos("Put /listing", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
// Extract the info from the Json string
|
||||
for (LLSD::array_iterator it = result["listings"].beginArray();
|
||||
it != result["listings"].endArray(); ++it)
|
||||
@@ -532,9 +557,12 @@ public:
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
log_SLM_warning("Put /associate_inventory", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Put /associate_inventory", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
update_marketplace_category(folderId, false);
|
||||
update_marketplace_category(sourceFolderId, false);
|
||||
gInventory.notifyObservers();
|
||||
@@ -543,9 +571,6 @@ public:
|
||||
|
||||
log_SLM_infos("Put /associate_inventory", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
for (LLSD::array_iterator it = result["listings"].beginArray();
|
||||
it != result["listings"].endArray(); ++it)
|
||||
{
|
||||
@@ -604,10 +629,12 @@ public:
|
||||
|
||||
std::string body;
|
||||
decode_raw_body(channels, buffer, body);
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);
|
||||
|
||||
if (!isGoodStatus(mStatus))
|
||||
{
|
||||
log_SLM_warning("Delete /listing", getStatus(), getReason(), "", body);
|
||||
log_SLM_warning("Delete /listing", getStatus(), getReason(), LLStringUtil::null, result);
|
||||
update_marketplace_category(folderId, false);
|
||||
gInventory.notifyObservers();
|
||||
return;
|
||||
@@ -615,9 +642,6 @@ public:
|
||||
|
||||
log_SLM_infos("Delete /listing", getStatus(), body);
|
||||
|
||||
auto json = nlohmann::json::parse(body);
|
||||
LLSD result = LlsdFromJson(json);;
|
||||
|
||||
for (LLSD::array_iterator it = result["listings"].beginArray();
|
||||
it != result["listings"].endArray(); ++it)
|
||||
{
|
||||
|
||||
@@ -363,7 +363,7 @@ There is no marketplace on the region you've moved to.
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="StockPasteFailed"
|
||||
type="outbox">
|
||||
type="alert">
|
||||
Copy or move to Stock Folder failed with error :
|
||||
|
||||
'[ERROR_CODE]'
|
||||
@@ -375,7 +375,7 @@ Copy or move to Stock Folder failed with error :
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="MerchantPasteFailed"
|
||||
type="outbox">
|
||||
type="alert">
|
||||
Copy or move to Marketplace Listings failed with error :
|
||||
|
||||
'[ERROR_CODE]'
|
||||
@@ -387,11 +387,10 @@ Copy or move to Marketplace Listings failed with error :
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="MerchantTransactionFailed"
|
||||
type="outbox">
|
||||
type="alert">
|
||||
The transaction with the Marketplace failed with the following error :
|
||||
|
||||
Reason : '[ERROR_REASON]'
|
||||
[ERROR_DESCRIPTION]
|
||||
[ERROR_REASON][ERROR_DESCRIPTION]
|
||||
<usetemplate
|
||||
name="okbutton"
|
||||
yestext="OK"/>
|
||||
@@ -400,7 +399,7 @@ Reason : '[ERROR_REASON]'
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="MerchantUnprocessableEntity"
|
||||
type="outbox">
|
||||
type="alert">
|
||||
We are unable to list this product or activate the version folder. Usually this is caused by missing information in the listing description form, but it may be due to errors in the folder structure. Either edit the listing or check the listing folder for errors.
|
||||
<usetemplate
|
||||
name="okbutton"
|
||||
@@ -410,10 +409,24 @@ We are unable to list this product or activate the version folder. Usually this
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="MerchantListingFailed"
|
||||
type="outbox">
|
||||
type="alert">
|
||||
Listing to Marketplace failed with error :
|
||||
|
||||
'[ERROR_CODE]'
|
||||
|
||||
<usetemplate
|
||||
name="okbutton"
|
||||
yestext="OK"/>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="OutboxStatus_Error"
|
||||
name="MerchantFolderActivationFailed"
|
||||
type="alert">
|
||||
Activating this version folder failed with error :
|
||||
|
||||
'[ERROR_CODE]'
|
||||
|
||||
<usetemplate
|
||||
name="okbutton"
|
||||
yestext="OK"/>
|
||||
@@ -483,7 +496,7 @@ You don't have permission to copy one or more of these items to the Marketplace.
|
||||
ignoretext="Confirm before I try to copy a selection containing no copy items to the marketplace"
|
||||
name="yesnocancelbuttons"
|
||||
yestext="Move item(s)"
|
||||
notext="Dont move item(s)"
|
||||
notext="Don't move item(s)"
|
||||
canceltext="Cancel"/>
|
||||
</notification>
|
||||
|
||||
@@ -504,7 +517,7 @@ This action will unlist this listing. Do you want to continue?
|
||||
icon="alertmodal.tga"
|
||||
name="ConfirmMerchantClearVersion"
|
||||
type="alertmodal">
|
||||
This action will deactivate the version folder of this listing. Do you want to continue?
|
||||
This action will deactivate the version folder of the current listing. Do you want to continue?
|
||||
<tag>confirm</tag>
|
||||
<usetemplate
|
||||
ignoretext="Confirm before I deactivate the version folder of a listing on the marketplace"
|
||||
@@ -518,7 +531,7 @@ This action will deactivate the version folder of this listing. Do you want to c
|
||||
name="AlertMerchantListingNotUpdated"
|
||||
type="alertmodal">
|
||||
This listing could not be updated.
|
||||
[URL] Click to edit it on the Marketplace.
|
||||
[[URL] Click here] to edit it on the Marketplace.
|
||||
<usetemplate
|
||||
name="okbutton"
|
||||
yestext="OK"/>
|
||||
|
||||
Reference in New Issue
Block a user