diff options
author | Merov Linden <merov@lindenlab.com> | 2015-06-10 14:53:12 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-06-10 14:53:12 -0700 |
commit | ab73b1af8fad5f012f782632a08740b4a0a1c8fa (patch) | |
tree | ec53e2587cd5063e11dbedd10dd8286bcf126249 | |
parent | 97fc50e1618b5441d6c7f305506801b85b4caacd (diff) |
DD-416 : Added DAMA when version folder is empty and unlisted, accelerated some functions avoiding depth computation when we could, fixed cut case
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 13 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 9 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 83 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 18 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/notifications.xml | 12 |
5 files changed, 98 insertions, 37 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d8dfe35eb5..48e5602682 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -968,7 +968,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, items.push_back(std::string("Marketplace Check Listing")); items.push_back(std::string("Marketplace List")); items.push_back(std::string("Marketplace Unlist")); - if (LLMarketplaceData::instance().isUpdating(mUUID) || ((flags & FIRST_SELECTED_ITEM) == 0)) + if (LLMarketplaceData::instance().isUpdating(mUUID,depth) || ((flags & FIRST_SELECTED_ITEM) == 0)) { // During SLM update, disable all marketplace related options // Also disable all if multiple selected items @@ -1024,7 +1024,7 @@ void LLInvFVBridge::addMarketplaceContextMenuOptions(U32 flags, { items.push_back(std::string("Marketplace Activate")); items.push_back(std::string("Marketplace Deactivate")); - if (LLMarketplaceData::instance().isUpdating(mUUID) || ((flags & FIRST_SELECTED_ITEM) == 0)) + if (LLMarketplaceData::instance().isUpdating(mUUID,depth) || ((flags & FIRST_SELECTED_ITEM) == 0)) { // During SLM update, disable all marketplace related options // Also disable all if multiple selected items @@ -3219,7 +3219,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) { if (depth_nesting_in_marketplace(mUUID) == 1) { - LLMarketplaceData::instance().activateListing(mUUID,false); + LLMarketplaceData::instance().activateListing(mUUID,false,1); } return; } @@ -3228,7 +3228,7 @@ 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(), LLUUID::null); + LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), LLUUID::null, 2); } return; } @@ -4378,7 +4378,8 @@ std::string LLMarketplaceFolderBridge::getLabelSuffix() const suffix += " (" + LLTrans::getString("MarketplaceActive") + ")"; } // Add stock amount - if (!LLMarketplaceData::instance().isUpdating(getUUID())) + bool updating = LLMarketplaceData::instance().isUpdating(getUUID()); + if (!updating) { // Skip computation (expensive) if we're waiting for update anyway. Use the old value in that case. m_stockCountCache = compute_stock_count(getUUID()); @@ -4407,7 +4408,7 @@ std::string LLMarketplaceFolderBridge::getLabelSuffix() const } } // Add updating suffix - if (LLMarketplaceData::instance().isUpdating(getUUID())) + if (updating) { suffix += " (" + LLTrans::getString("MarketplaceUpdating") + ")"; } diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index d9002a631d..b241bfa466 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -285,19 +285,20 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc if (version_folder_uuid.notNull() && (!gInventory.isObjectDescendentOf(version_folder_uuid, listing_uuid) || (version_depth != 2))) { LL_INFOS("SLM") << "Unlist and clear version folder as the version folder is not at the right place anymore!!" << LL_ENDL; - LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null); + LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null,1); } - else if (version_folder_uuid.notNull() && (count_descendants_items(version_folder_uuid) == 0)) + else if (version_folder_uuid.notNull() && LLMarketplaceData::instance().getActivationState(version_folder_uuid) && (count_descendants_items(version_folder_uuid) == 0) && !LLMarketplaceData::instance().isUpdating(version_folder_uuid,version_depth)) { LL_INFOS("SLM") << "Unlist as the version folder is empty of any item!!" << LL_ENDL; - LLMarketplaceData::instance().activateListing(listing_uuid, false); + LLNotificationsUtil::add("AlertMerchantVersionFolderEmpty"); + LLMarketplaceData::instance().activateListing(listing_uuid, false,1); } } // Check if the count on hand needs to be updated on SLM if (perform_consistency_enforcement && (compute_stock_count(listing_uuid) != LLMarketplaceData::instance().getCountOnHand(listing_uuid))) { - LLMarketplaceData::instance().updateCountOnHand(listing_uuid); + LLMarketplaceData::instance().updateCountOnHand(listing_uuid,1); } // Update all descendents starting from the listing root update_marketplace_folder_hierarchy(listing_uuid); diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 3fec9e0da7..4a78d39be9 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1449,7 +1449,7 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id) return true; } -bool LLMarketplaceData::clearListing(const LLUUID& folder_id) +bool LLMarketplaceData::clearListing(const LLUUID& folder_id, S32 depth) { if (folder_id.isNull()) { @@ -1457,8 +1457,13 @@ bool LLMarketplaceData::clearListing(const LLUUID& folder_id) return false; } + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } // Folder id can be the root of the listing or not so we need to retrieve the root first - S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = (isListed(folder_id) ? folder_id : nested_parent_id(folder_id, depth)); S32 listing_id = getListingID(listing_uuid); @@ -1474,7 +1479,7 @@ bool LLMarketplaceData::clearListing(const LLUUID& folder_id) return true; } -bool LLMarketplaceData::getListing(const LLUUID& folder_id) +bool LLMarketplaceData::getListing(const LLUUID& folder_id, S32 depth) { if (folder_id.isNull()) { @@ -1482,8 +1487,13 @@ bool LLMarketplaceData::getListing(const LLUUID& folder_id) return false; } + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } // Folder id can be the root of the listing or not so we need to retrieve the root first - S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = (isListed(folder_id) ? folder_id : nested_parent_id(folder_id, depth)); S32 listing_id = getListingID(listing_uuid); @@ -1511,10 +1521,15 @@ bool LLMarketplaceData::getListing(S32 listing_id) return true; } -bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate) +bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate, S32 depth) { + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } // Folder id can be the root of the listing or not so we need to retrieve the root first - S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = nested_parent_id(folder_id, depth); S32 listing_id = getListingID(listing_uuid); if (listing_id == 0) @@ -1546,10 +1561,15 @@ bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate) return true; } -bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id) +bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id, S32 depth) { + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } // Folder id can be the root of the listing or not so we need to retrieve the root first - S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = nested_parent_id(folder_id, depth); S32 listing_id = getListingID(listing_uuid); if (listing_id == 0) @@ -1582,10 +1602,15 @@ bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID& return true; } -bool LLMarketplaceData::updateCountOnHand(const LLUUID& folder_id) +bool LLMarketplaceData::updateCountOnHand(const LLUUID& folder_id, S32 depth) { + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } // Folder id can be the root of the listing or not so we need to retrieve the root first - S32 depth = depth_nesting_in_marketplace(folder_id); LLUUID listing_uuid = nested_parent_id(folder_id, depth); S32 listing_id = getListingID(listing_uuid); if (listing_id == 0) @@ -1756,9 +1781,15 @@ LLUUID LLMarketplaceData::getListingFolder(S32 listing_id) return LLUUID::null; } -std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id) +std::string LLMarketplaceData::getListingURL(const LLUUID& folder_id, S32 depth) { - S32 depth = depth_nesting_in_marketplace(folder_id); + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + + } + LLUUID listing_uuid = nested_parent_id(folder_id, depth); marketplace_items_list_t::iterator it = mMarketplaceItems.find(listing_uuid); @@ -1782,25 +1813,41 @@ bool LLMarketplaceData::isVersionFolder(const LLUUID& folder_id) return (it != mVersionFolders.end()); } -bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id) +bool LLMarketplaceData::isInActiveFolder(const LLUUID& obj_id, S32 depth) { - S32 depth = depth_nesting_in_marketplace(obj_id); + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(obj_id); + + } + LLUUID listing_uuid = nested_parent_id(obj_id, depth); bool active = getActivationState(listing_uuid); LLUUID version_uuid = getVersionFolder(listing_uuid); return (active && ((obj_id == version_uuid) || gInventory.isObjectDescendentOf(obj_id, version_uuid))); } -LLUUID LLMarketplaceData::getActiveFolder(const LLUUID& obj_id) +LLUUID LLMarketplaceData::getActiveFolder(const LLUUID& obj_id, S32 depth) { - S32 depth = depth_nesting_in_marketplace(obj_id); + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(obj_id); + + } + LLUUID listing_uuid = nested_parent_id(obj_id, depth); return (getActivationState(listing_uuid) ? getVersionFolder(listing_uuid) : LLUUID::null); } -bool LLMarketplaceData::isUpdating(const LLUUID& folder_id) +bool LLMarketplaceData::isUpdating(const LLUUID& folder_id, S32 depth) { - S32 depth = depth_nesting_in_marketplace(folder_id); + // Evaluate the depth if it wasn't passed as a parameter + if (depth < 0) + { + depth = depth_nesting_in_marketplace(folder_id); + } if ((depth <= 0) || (depth > 2)) { // Only listing and version folders though are concerned by that status diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 26b1ddc579..f8e7ed4364 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -208,12 +208,12 @@ public: // High level create/delete/set Marketplace data: each method returns true if the function succeeds, false if error bool createListing(const LLUUID& folder_id); - bool activateListing(const LLUUID& folder_id, bool activate); - bool clearListing(const LLUUID& folder_id); - bool setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id); + bool activateListing(const LLUUID& folder_id, bool activate, S32 depth = -1); + bool clearListing(const LLUUID& folder_id, S32 depth = -1); + bool setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id, S32 depth = -1); bool associateListing(const LLUUID& folder_id, const LLUUID& source_folder_id, S32 listing_id); - bool updateCountOnHand(const LLUUID& folder_id); - bool getListing(const LLUUID& folder_id); + bool updateCountOnHand(const LLUUID& folder_id, S32 depth = -1); + bool getListing(const LLUUID& folder_id, S32 depth = -1); bool getListing(S32 listing_id); bool deleteListing(S32 listing_id, bool update = true); @@ -221,15 +221,15 @@ public: bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder bool isListedAndActive(const LLUUID& folder_id); // returns true if folder_id is an active (listed) Listing folder bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder - bool isInActiveFolder(const LLUUID& obj_id); // returns true if the obj_id is buried in an active version folder - LLUUID getActiveFolder(const LLUUID& obj_id); // returns the UUID of the active version folder obj_id is in - bool isUpdating(const LLUUID& folder_id); // returns true if we're waiting from SLM incoming data for folder_id + bool isInActiveFolder(const LLUUID& obj_id, S32 depth = -1); // returns true if the obj_id is buried in an active version folder + LLUUID getActiveFolder(const LLUUID& obj_id, S32 depth = -1); // returns the UUID of the active version folder obj_id is in + bool isUpdating(const LLUUID& folder_id, S32 depth = -1); // returns true if we're waiting from SLM incoming data for folder_id // Access Marketplace data set : each method returns a default value if the argument can't be found bool getActivationState(const LLUUID& folder_id); S32 getListingID(const LLUUID& folder_id); LLUUID getVersionFolder(const LLUUID& folder_id); - std::string getListingURL(const LLUUID& folder_id); + std::string getListingURL(const LLUUID& folder_id, S32 depth = -1); LLUUID getListingFolder(S32 listing_id); S32 getCountOnHand(const LLUUID& folder_id); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 03f7de34ed..eb5dfdaf30 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -540,6 +540,18 @@ This listing could not be updated. yestext="OK"/> </notification> + <notification + icon="alertmodal.tga" + name="AlertMerchantVersionFolderEmpty" + type="alertmodal"> + We have unlisted your listing because the version folder is empty. You need to add items to the version folder to list the listing again. + <tag>confirm</tag> + <usetemplate + ignoretext="Alert when a listing is unlisted because version folder is empty" + name="okignore" + yestext="OK"/> + </notification> + <notification icon="alertmodal.tga" name="CompileQueueSaveText" |