From 883890e3fb0c5d9d8014ea8daf2b432dd3186dab Mon Sep 17 00:00:00 2001 From: Beq Date: Wed, 25 May 2022 00:17:30 +0100 Subject: [PATCH] [FIRE-31674] [OPENSIM] Skip validatiion of suitcase and its contents --- indra/newview/llinventorymodel.cpp | 61 ++++++++++++++++++++++++++++++ indra/newview/llinventorymodel.h | 6 ++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index b0b014dc83..2af4621c7f 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -398,7 +398,50 @@ LLInventoryModel::EAnscestorResult LLInventoryModel::getObjectTopmostAncestor(co result = object->getUUID(); return ANSCESTOR_OK; } +// [OPENSIM] FIRE-31674 Exclude suitcase and descendents from validation when in OpenSim +#ifdef OPENSIM +bool LLInventoryModel::isInSuitcase(const LLInventoryCategory * cat) const +{ + if(LLGridManager::getInstance()->isInSecondLife()) + { + return false; + } + if (!cat) + { + LL_WARNS(LOG_INV) << "Unable to trace parentage of null cat " << LL_ENDL; + return false; + } + auto cat_id = cat->getUUID(); + std::set cat_ids{ cat_id }; // loop protection + if(cat->getPreferredType() == LLFolderType::FT_MY_SUITCASE) + return true; + while (cat->getParentUUID().notNull()) + { + LLUUID parent_id = cat->getParentUUID(); + if (cat_ids.find(parent_id) != cat_ids.end()) + { + LL_WARNS(LOG_INV) << "Detected a loop on a cat " << parent_id << " when searching for ancestor of " << cat_id << LL_ENDL; + return false; + } + cat_ids.insert(parent_id); + auto parent_cat = getCategory(parent_id); + if (!parent_cat) + { + LL_WARNS(LOG_INV) << "unable to trace parentage of " << cat_id << ", missing item for uuid " << parent_id << LL_ENDL; + return false; + } + LL_DEBUGS(LOG_INV) << "Parent folder is " << parent_cat->getName() << "; Folder type " << parent_cat->getPreferredType() << LL_ENDL; + if(parent_cat->getPreferredType() == LLFolderType::FT_MY_SUITCASE) + { + return true; + } + cat = parent_cat; + cat_id = cat->getUUID(); + } + return false; +} +#endif // Get the object by id. Returns NULL if not found. LLInventoryObject* LLInventoryModel::getObject(const LLUUID& id) const { @@ -4474,6 +4517,15 @@ LLPointer LLInventoryModel::validate() const warnings++; } } + // FIRE-31674 Suitcase contents do not need checking. + #ifdef OPENSIM + if (isInSuitcase(cat)) + { + LL_DEBUGS("Inventory") << "cat " << cat->getName() << " skipped because it is a child of Suitcase" << LL_ENDL; + continue; + } + #endif + // cat_array_t* cats; item_array_t* items; getDirectDescendentsOf(cat_id,cats,items); @@ -4621,6 +4673,15 @@ LLPointer LLInventoryModel::validate() const } if (!cat_is_in_library) { + // FIRE-31674 [OPENSIM] don't count things underneath suitcase + #ifdef OPENSIM + if ( isInSuitcase(cat) ) + { + LL_DEBUGS("Inventory") << "Under suitcase cat: " << getFullPath(cat) << " folder_type " << folder_type << LL_ENDL; + } + else + #endif + // if (getRootFolderID().notNull() && (cat->getUUID()==getRootFolderID() || cat->getParentUUID()==getRootFolderID())) { ft_counts_under_root[folder_type]++; diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index 8ea89d26b6..754f7b70ac 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -312,7 +312,11 @@ public: }; // Follow parent chain to the top. EAnscestorResult getObjectTopmostAncestor(const LLUUID& object_id, LLUUID& result) const; - + // FIRE-31674 ignore suitcase contents + #ifdef OPENSIM + bool isInSuitcase(const LLInventoryCategory * cat) const; + #endif + // // Re-added because of start folder id // Collect all items in inventory that are linked to item_id. // Assumes item_id is itself not a linked item.