summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-17 02:20:28 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-11-17 16:38:58 +0200
commit6abeb9983e0f8a937c84f67a17a6dcc4d6484698 (patch)
treee5ebcf9ac105b55423a08fb2e7cdc1665b0aa8af /indra/newview
parente1fc7679f251a5cead135cbe78fcdfdfc749a3e2 (diff)
SL-20607 Version folder was not created when copying folders to marketplace
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventoryfunctions.cpp25
-rw-r--r--indra/newview/llmarketplacefunctions.cpp52
2 files changed, 26 insertions, 51 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 4aeacae6ed..6662f14b12 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -462,6 +462,13 @@ void copy_inventory_category(LLInventoryModel* model,
gInventory.createNewCategory(parent_id, LLFolderType::FT_NONE, cat->getName(), func, cat->getThumbnailUUID());
}
+void copy_cb(const LLUUID& dest_folder, const LLUUID& root_id)
+{
+ // Decrement the count in root_id since that one item won't be copied over
+ LLMarketplaceData::instance().decrementValidationWaiting(root_id);
+ update_folder_cb(dest_folder);
+};
+
void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryModel* model, LLViewerInventoryCategory* cat, const LLUUID& root_copy_id, bool move_no_copy_items)
{
model->notifyObservers();
@@ -480,12 +487,21 @@ void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryMode
LLMarketplaceData::instance().setValidationWaiting(root_id, count_descendants_items(cat->getUUID()));
}
+ LLPointer<LLInventoryCallback> cb;
+ if (root_copy_id.isNull())
+ {
+ cb = new LLBoostFuncInventoryCallback(boost::bind(copy_cb, new_cat_uuid, root_id));
+ }
+ else
+ {
+ cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid));
+ }
+
// Copy all the items
LLInventoryModel::item_array_t item_array_copy = *item_array;
for (LLInventoryModel::item_array_t::iterator iter = item_array_copy.begin(); iter != item_array_copy.end(); iter++)
{
LLInventoryItem* item = *iter;
- LLPointer<LLInventoryCallback> cb = new LLBoostFuncInventoryCallback(boost::bind(update_folder_cb, new_cat_uuid));
if (item->getIsLinkType())
{
@@ -500,8 +516,11 @@ void copy_inventory_category_content(const LLUUID& new_cat_uuid, LLInventoryMode
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *)item;
gInventory.changeItemParent(viewer_inv_item, new_cat_uuid, true);
}
- // Decrement the count in root_id since that one item won't be copied over
- LLMarketplaceData::instance().decrementValidationWaiting(root_id);
+ if (root_copy_id.isNull())
+ {
+ // Decrement the count in root_id since that one item won't be copied over
+ LLMarketplaceData::instance().decrementValidationWaiting(root_id);
+ }
}
else
{
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 8784f403cb..d27ee941a6 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -611,27 +611,17 @@ private:
static void onIdleProcessQueue(void *userdata);
// doesn't hold just marketplace related ids
- static std::set<LLUUID> sAddQueue;
static std::set<LLUUID> sStructureQueue;
static bool sProcessingQueue;
};
-std::set<LLUUID> LLMarketplaceInventoryObserver::sAddQueue;
std::set<LLUUID> LLMarketplaceInventoryObserver::sStructureQueue;
bool LLMarketplaceInventoryObserver::sProcessingQueue = false;
void LLMarketplaceInventoryObserver::changed(U32 mask)
{
- if (mask & LLInventoryObserver::ADD && LLMarketplaceData::instance().hasValidationWaiting())
- {
- // When things are added to the marketplace, we might need to re-validate and fix the containing listings
- // just add whole list even if it contains items and non-marketplace folders
- const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
- sAddQueue.insert(changed_items.begin(), changed_items.end());
- }
-
- if (mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE))
- {
+ if (mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE))
+ {
// When things are changed in the inventory, this can trigger a host of changes in the marketplace listings folder:
// * stock counts changing : no copy items coming in and out will change the stock count on folders
// * version and listing folders : moving those might invalidate the marketplace data itself
@@ -641,7 +631,7 @@ void LLMarketplaceInventoryObserver::changed(U32 mask)
sStructureQueue.insert(changed_items.begin(), changed_items.end());
}
- if (!sProcessingQueue && (!sAddQueue.empty() || !sStructureQueue.empty()))
+ if (!sProcessingQueue && !sStructureQueue.empty())
{
gIdleCallbacks.addFunction(onIdleProcessQueue, NULL);
// can do without sProcessingQueue, but it's usufull for simplicity and reliability
@@ -655,40 +645,6 @@ void LLMarketplaceInventoryObserver::onIdleProcessQueue(void *userdata)
const U64 MAX_PROCESSING_TIME = 1000;
U64 stop_time = start_time + MAX_PROCESSING_TIME;
- if (!sAddQueue.empty())
- {
- // Make a copy of sAddQueue since decrementValidationWaiting
- // can theoretically add more items
- std::set<LLUUID> add_queue(sAddQueue);
- sAddQueue.clear();
-
- std::set<LLUUID>::const_iterator id_it = add_queue.begin();
- std::set<LLUUID>::const_iterator id_end = add_queue.end();
- // First, count the number of items in this list...
- S32 count = 0;
- for (; id_it != id_end; ++id_it)
- {
- LLInventoryObject* obj = gInventory.getObject(*id_it);
- if (obj && (LLAssetType::AT_CATEGORY != obj->getType()))
- {
- count++;
- }
- }
- // Then, decrement the folders of that amount
- // Note that of all of those, only one folder will be a listing folder (if at all).
- // The other will be ignored by the decrement method.
- id_it = add_queue.begin();
- for (; id_it != id_end; ++id_it)
- {
- LLInventoryObject* obj = gInventory.getObject(*id_it);
- if (obj && (LLAssetType::AT_CATEGORY == obj->getType()))
- {
- // can trigger notifyObservers
- LLMarketplaceData::instance().decrementValidationWaiting(obj->getUUID(), count);
- }
- }
- }
-
while (!sStructureQueue.empty() && LLTimer::getTotalTime() < stop_time)
{
std::set<LLUUID>::const_iterator id_it = sStructureQueue.begin();
@@ -722,7 +678,7 @@ void LLMarketplaceInventoryObserver::onIdleProcessQueue(void *userdata)
sStructureQueue.erase(id_it);
}
- if (LLApp::isExiting() || (sAddQueue.empty() && sStructureQueue.empty()))
+ if (LLApp::isExiting() || sStructureQueue.empty())
{
// Nothing to do anymore
gIdleCallbacks.deleteFunction(onIdleProcessQueue, NULL);