summaryrefslogtreecommitdiff
path: root/indra/newview/llinventorymodel.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2018-06-21 09:13:19 -0700
committerRider Linden <rider@lindenlab.com>2018-06-21 09:13:19 -0700
commitf07dc421e81d945531dc6f4befc19ea4fe4b9a47 (patch)
tree7ac8fa1fbfad64c616161488a5d0be10c1eaba34 /indra/newview/llinventorymodel.cpp
parent8b3957b310afa23e543c3eb33aca9131dba52b31 (diff)
parentdc07de2f4a4c49d1877bf743b6f0d209392f6eb6 (diff)
Merge
Diffstat (limited to 'indra/newview/llinventorymodel.cpp')
-rw-r--r--indra/newview/llinventorymodel.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 678fdbef35..cef6528724 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -925,7 +925,20 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
new_item = old_item;
LLUUID old_parent_id = old_item->getParentUUID();
LLUUID new_parent_id = item->getParentUUID();
-
+ bool update_parent_on_server = false;
+
+ if (new_parent_id.isNull())
+ {
+ // item with null parent will end in random location and then in Lost&Found,
+ // either move to default folder as if it is new item or don't move at all
+ LL_WARNS(LOG_INV) << "Update attempts to reparent item " << item->getUUID()
+ << " to null folder. Moving to Lost&Found. Old item name: " << old_item->getName()
+ << ". New name: " << item->getName()
+ << "." << LL_ENDL;
+ new_parent_id = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+ update_parent_on_server = true;
+ }
+
if(old_parent_id != new_parent_id)
{
// need to update the parent-child tree
@@ -938,6 +951,11 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
item_array = get_ptr_in_map(mParentChildItemTree, new_parent_id);
if(item_array)
{
+ if (update_parent_on_server)
+ {
+ LLInventoryModel::LLCategoryUpdate update(new_parent_id, 1);
+ gInventory.accountForUpdate(update);
+ }
item_array->push_back(old_item);
}
mask |= LLInventoryObserver::STRUCTURE;
@@ -947,6 +965,12 @@ U32 LLInventoryModel::updateItem(const LLViewerInventoryItem* item, U32 mask)
mask |= LLInventoryObserver::LABEL;
}
old_item->copyViewerItem(item);
+ if (update_parent_on_server)
+ {
+ // Parent id at server is null, so update server even if item already is in the same folder
+ old_item->setParent(new_parent_id);
+ new_item->updateParentOnServer(FALSE);
+ }
mask |= LLInventoryObserver::INTERNAL;
}
else
@@ -2820,7 +2844,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32
item_array_t items;
update_map_t update;
S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
- LLUUID folder_id;
// Does this loop ever execute more than once?
for(S32 i = 0; i < count; ++i)
{
@@ -2847,10 +2870,6 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, U32
{
++update[titem->getParentUUID()];
}
- if (folder_id.isNull())
- {
- folder_id = titem->getParentUUID();
- }
}
if(account)
{