summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-06-30 01:53:39 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-06-30 01:53:39 +0300
commit924869900ae2646987ce2a8f0b494345701c50a6 (patch)
treebe72fd5a420ca5a52a765da6709390d63605ec58
parentab18293d35c4ce391f65efaa65be53cdbe84f550 (diff)
SL-19938 Make sure marketplace removes empty folder it automatically moved items from
when folder was recreated into stock fodler
-rw-r--r--indra/newview/llinventoryfunctions.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 3a53425e43..f813639073 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1825,6 +1825,7 @@ void validate_marketplacelistings(
{
// Create a new folder
const LLUUID parent_uuid = (depth > 2 ? viewer_cat->getParentUUID() : viewer_cat->getUUID());
+ const LLUUID origin_uuid = viewer_cat->getUUID();
LLViewerInventoryItem* viewer_inv_item = gInventory.getItem(items_vector_it->second.back());
std::string folder_name = (depth >= 1 ? viewer_cat->getName() : viewer_inv_item->getName());
LLFolderType::EType new_folder_type = (items_vector_it->first == default_key ? LLFolderType::FT_NONE : LLFolderType::FT_MARKETPLACE_STOCK);
@@ -1848,7 +1849,7 @@ void validate_marketplacelistings(
parent_uuid,
new_folder_type,
folder_name,
- [uuid_vector, cb_result, cb_msg, depth, parent_uuid, notify_observers](const LLUUID &new_category_id)
+ [uuid_vector, cb_result, cb_msg, depth, parent_uuid, origin_uuid, notify_observers](const LLUUID &new_category_id)
{
// Move each item to the new folder
std::vector<LLUUID>::const_reverse_iterator iter = uuid_vector.rbegin();
@@ -1869,6 +1870,31 @@ void validate_marketplacelistings(
iter++;
}
+ if (origin_uuid != parent_uuid)
+ {
+ // We might have moved last item from a folder, check if it needs to be removed
+ LLViewerInventoryCategory* cat = gInventory.getCategory(origin_uuid);
+ if (cat->getDescendentCount() == 0)
+ {
+ // Remove previous folder if it ends up empty
+ if (cb_msg)
+ {
+ std::string indent;
+ for (int i = 1; i < depth; i++)
+ {
+ indent += " ";
+ }
+ std::string message = indent + cat->getName() + LLTrans::getString("Marketplace Validation Warning Delete");
+ cb_msg(message, depth, LLError::LEVEL_WARN);
+ }
+ gInventory.removeCategory(cat->getUUID());
+ if (notify_observers)
+ {
+ gInventory.notifyObservers();
+ }
+ }
+ }
+
// Next type
update_marketplace_category(parent_uuid);
update_marketplace_category(new_category_id);