From 04501955c7d0cd19d13ac1374f6f06e944f6ea61 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Thu, 23 Mar 2023 21:13:30 +0200
Subject: SL-19108 Disable "Image" button for task inventories

Thumbnails are not supported for task inventories yet
---
 indra/newview/llaisapi.cpp            | 5 +++--
 indra/newview/llinventorymodel.cpp    | 4 ++++
 indra/newview/llsidepaneliteminfo.cpp | 8 ++++++--
 indra/newview/llsidepaneliteminfo.h   | 5 +++--
 4 files changed, 16 insertions(+), 6 deletions(-)

(limited to 'indra/newview')

diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index d2bf7a0e9a..d0c8d38e28 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -543,7 +543,8 @@ void AISAPI::onIdle(void *userdata)
 void AISAPI::onUpdateReceived(const std::string& context, const LLSD& update, COMMAND_TYPE type, const LLSD& request_body)
 {
     LLTimer timer;
-    if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
+    if ( (type == UPDATECATEGORY || type == UPDATEITEM)
+        && gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"))
     {
         dump_sequential_xml(gAgentAvatarp->getFullname() + "_ais_update", update);
     }
@@ -558,7 +559,7 @@ void AISAPI::onUpdateReceived(const std::string& context, const LLSD& update, CO
     }
     AISUpdate ais_update(update, is_fetch, depth);
     ais_update.doUpdate(); // execute the updates in the appropriate order.
-    LL_INFOS("Inventory") << "elapsed: " << timer.getElapsedTimeF32() << LL_ENDL;
+    LL_DEBUGS("Inventory") << "elapsed: " << timer.getElapsedTimeF32() << LL_ENDL;
 }
 
 /*static*/
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b833571ee9..6d9142cc5c 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3448,6 +3448,10 @@ void LLInventoryModel::processUpdateCreateInventoryItem(LLMessageSystem* msg, vo
 		msg->getU32Fast(_PREHASH_InventoryData, _PREHASH_CallbackID, callback_id);
 
 		gInventoryCallbacks.fire(callback_id, item_id);
+
+        // todo: instead of unpacking message fully,
+        // grab only an item_id, then fetch via AIS
+        AISAPI::FetchItem(item_id, AISAPI::INVENTORY);
 	}
 
 }
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index 312dee8c93..9660fa5916 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -154,15 +154,16 @@ LLSidepanelItemInfo::~LLSidepanelItemInfo()
 // virtual
 BOOL LLSidepanelItemInfo::postBuild()
 {
+    mChangeThumbnailBtn = getChild<LLUICtrl>("change_thumbnail_btn");
+    mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon");
     mLabelOwnerName = getChild<LLTextBox>("LabelOwnerName");
     mLabelCreatorName = getChild<LLTextBox>("LabelCreatorName");
-    mItemTypeIcon = getChild<LLIconCtrl>("item_type_icon");
     
 	getChild<LLLineEditor>("LabelItemName")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
 	getChild<LLUICtrl>("LabelItemName")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onCommitName,this));
 	getChild<LLUICtrl>("LabelItemDesc")->setCommitCallback(boost::bind(&LLSidepanelItemInfo:: onCommitDescription, this));
     // Thumnail edition
-    getChild<LLUICtrl>("change_thumbnail_btn")->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this));
+    mChangeThumbnailBtn->setCommitCallback(boost::bind(&LLSidepanelItemInfo::onEditThumbnail, this));
 	// acquired date
 	// owner permissions
 	// Permissions debug text
@@ -443,6 +444,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
         mLabelOwnerName->setEnabled(FALSE);
         mLabelOwnerName->setValue(getString("public"));
 	}
+
+    // Not yet supported for task inventories
+    mChangeThumbnailBtn->setEnabled(mObjectID.isNull());
 	
 	////////////
 	// ORIGIN //
diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h
index ba1d5c263a..b916f44520 100644
--- a/indra/newview/llsidepaneliteminfo.h
+++ b/indra/newview/llsidepaneliteminfo.h
@@ -100,10 +100,11 @@ private:
 	S32 mUpdatePendingId;
     bool mIsDirty;         // item properties need to be updated
     LLFloater* mParentFloater;
-    
+
+    LLUICtrl* mChangeThumbnailBtn;
+    LLIconCtrl* mItemTypeIcon;
     LLTextBox* mLabelOwnerName;
     LLTextBox* mLabelCreatorName;
-    LLIconCtrl* mItemTypeIcon;
 
 	//
 	// UI Elements
-- 
cgit v1.2.3