summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-10-08 00:29:00 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-10-08 18:05:45 +0300
commita43b2106853b516248a2e657a28084b7d906cf5f (patch)
tree0e1933c43521e2b7cf8b1e5f87a494550b3fa373 /indra/newview
parent3dca9fc377e855b74a78a5c30464b468dcc82644 (diff)
viewer#2818 Creating a link to an empty notecard fails
AIS 'Cannot link to items with a NULL asset_id.'
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llinventorybridge.cpp5
-rw-r--r--indra/newview/llinventorygallerymenu.cpp39
2 files changed, 35 insertions, 9 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 896c7d8d70..57e5030602 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -691,6 +691,11 @@ bool LLInvFVBridge::isClipboardPasteableAsLink() const
{
return false;
}
+ if (item->getAssetUUID().isNull())
+ {
+ // otehrwise AIS will return 'Cannot link to items with a NULL asset_id.'
+ return false;
+ }
}
const LLViewerInventoryCategory *cat = model->getCategory(item_id);
if (cat && LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
diff --git a/indra/newview/llinventorygallerymenu.cpp b/indra/newview/llinventorygallerymenu.cpp
index c84b9abba0..320cbcdb1e 100644
--- a/indra/newview/llinventorygallerymenu.cpp
+++ b/indra/newview/llinventorygallerymenu.cpp
@@ -598,20 +598,23 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
bool has_children = false;
bool is_full_perm_item = false;
bool is_copyable = false;
- LLViewerInventoryItem* selected_item = gInventory.getItem(selected_id);
+
+ LLViewerInventoryCategory* selected_category = nullptr;
+ LLViewerInventoryItem* selected_item = nullptr;
if(is_folder)
{
- LLInventoryCategory* category = gInventory.getCategory(selected_id);
- if (category)
+ selected_category = dynamic_cast<LLViewerInventoryCategory*>(obj);
+ if (selected_category)
{
- folder_type = category->getPreferredType();
+ folder_type = selected_category->getPreferredType();
is_system_folder = LLFolderType::lookupIsProtectedType(folder_type);
has_children = (gInventory.categoryHasChildren(selected_id) != LLInventoryModel::CHILDREN_NO);
}
}
else
{
+ selected_item = dynamic_cast<LLViewerInventoryItem*>(obj);
if (selected_item)
{
is_full_perm_item = selected_item->getIsFullPerm();
@@ -730,8 +733,7 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
if (is_agent_inventory && !is_inbox && !is_cof && !is_in_favorites && !is_outfits)
{
- LLViewerInventoryCategory* category = gInventory.getCategory(selected_id);
- if (!category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(category))
+ if (!selected_category || !LLFriendCardsManager::instance().isCategoryInFriendFolder(selected_category))
{
items.push_back(std::string("New Folder"));
}
@@ -759,6 +761,26 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
if (inventory_linking)
{
items.push_back(std::string("Paste As Link"));
+
+ if (selected_item)
+ {
+ if (!LLAssetType::lookupCanLink(selected_item->getActualType()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ else if (gInventory.isObjectDescendentOf(selected_item->getUUID(), gInventory.getLibraryRootFolderID()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ else if (selected_item->getAssetUUID().isNull())
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
+ }
+ else if (selected_category && LLFolderType::lookupIsProtectedType(selected_category->getPreferredType()))
+ {
+ disabled_items.push_back(std::string("Paste As Link"));
+ }
}
}
if (is_folder && is_agent_inventory)
@@ -979,9 +1001,8 @@ void LLInventoryGalleryContextMenu::updateMenuItemsVisibility(LLContextMenu* men
{
if (is_folder)
{
- LLViewerInventoryCategory* cat = gInventory.getCategory(selected_id);
- if (cat
- && !LLFolderType::lookupIsProtectedType(cat->getPreferredType())
+ if (selected_category
+ && !LLFolderType::lookupIsProtectedType(selected_category->getPreferredType())
&& gInventory.isObjectDescendentOf(selected_id, gInventory.getRootFolderID()))
{
can_list = true;