summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCosmic Linden <cosmic@lindenlab.com>2023-11-08 16:23:36 -0800
committerCosmic Linden <cosmic@lindenlab.com>2023-11-09 13:54:43 -0800
commita66a990165a2ade9cba26963fe0c7b4a21b9dcac (patch)
tree754732201a3b8079e820ecf65333ba5740ad1179 /indra/newview
parent4ad7e250f3302a6158378a5acbf88ac27dd95ced (diff)
SL-20553: Fix new material item still sometimes not updating in UI
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llmaterialeditor.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 2f4c29446e..8f016b9125 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -1313,16 +1313,22 @@ public:
return;
}
+ // Name may or may not have already been applied
+ const bool changed_name = item->getName() != mNewName;
// create_inventory_item/copy_inventory_item don't allow presetting some permissions, fix it now
- item->setPermissions(mPermissions);
- item->updateServer(FALSE);
- gInventory.updateItem(item);
- gInventory.notifyObservers();
-
- if (item->getName() != mNewName)
+ const bool changed_permissions = item->getPermissions() != mPermissions;
+ const bool changed = changed_name || changed_permissions;
+ LLSD updates;
+ if (changed)
{
- LLSD updates;
- updates["name"] = mNewName;
+ if (changed_name)
+ {
+ updates["name"] = mNewName;
+ }
+ if (changed_permissions)
+ {
+ updates["permissions"] = ll_create_sd_from_permissions(mPermissions);
+ }
update_inventory_item(inv_item_id, updates, NULL);
}
@@ -1332,10 +1338,16 @@ public:
inv_item_id,
LLAssetType::AT_MATERIAL,
mAssetData,
- [](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response)
+ [changed, updates](LLUUID item_id, LLUUID new_asset_id, LLUUID new_item_id, LLSD response)
{
// done callback
LL_INFOS("Material") << "inventory item uploaded. item: " << item_id << " new_item_id: " << new_item_id << " response: " << response << LL_ENDL;
+
+ // *HACK: Sometimes permissions do not stick in the UI. They are correct on the server-side, though.
+ if (changed)
+ {
+ update_inventory_item(new_item_id, updates, NULL);
+ }
},
nullptr // failure callback, floater already closed
);