From aab8ea7236e01f279c33eb1839ac2e0c4a1f9829 Mon Sep 17 00:00:00 2001
From: Mnikolenko Productengine <mnikolenko@productengine.com>
Date: Thu, 17 Oct 2019 19:15:02 +0300
Subject: [PATCH] SL-12121 FIXED Unable to delete folders from 'Marketplace
 listings'

---
 indra/newview/llinventorybridge.cpp      | 7 ++++++-
 indra/newview/llmarketplacefunctions.cpp | 5 +++++
 indra/newview/llmarketplacefunctions.h   | 4 +++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 6d2d533c9dc..16d39205fc1 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2270,7 +2270,7 @@ class LLIsItemRemovable : public LLFolderViewFunctor
 // Can be destroyed (or moved to trash)
 BOOL LLFolderBridge::isItemRemovable() const
 {
-	if (!get_is_category_removable(getInventoryModel(), mUUID) || isMarketplaceListingsFolder())
+	if (!get_is_category_removable(getInventoryModel(), mUUID))
 	{
 		return FALSE;
 	}
@@ -2287,6 +2287,11 @@ BOOL LLFolderBridge::isItemRemovable() const
 		}
 	}
 
+	if (isMarketplaceListingsFolder() && (!LLMarketplaceData::instance().isSLMDataFetched() || LLMarketplaceData::instance().getActivationState(mUUID)))
+	{
+		return FALSE;
+	}
+
 	return TRUE;
 }
 
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index a0e19f2d196..26977593f4a 100644
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -1294,6 +1294,11 @@ void LLMarketplaceData::setSLMDataFetched(U32 status)
     }
 }
 
+bool LLMarketplaceData::isSLMDataFetched()
+{
+    return mMarketPlaceDataFetched == MarketplaceFetchCodes::MARKET_FETCH_DONE;
+}
+
 // Creation / Deletion / Update
 // Methods publicly called
 bool LLMarketplaceData::createListing(const LLUUID& folder_id)
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index ec312baca39..fee9225f77c 100644
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -204,7 +204,9 @@ class LLMarketplaceData
     void setDataFetchedSignal(const status_updated_signal_t::slot_type& cb);
     void setSLMDataFetched(U32 status);
     U32 getSLMDataFetched() { return mMarketPlaceDataFetched; }
-    
+
+    bool isSLMDataFetched();
+
     // High level create/delete/set Marketplace data: each method returns true if the function succeeds, false if error
     bool createListing(const LLUUID& folder_id);
     bool activateListing(const LLUUID& folder_id, bool activate, S32 depth = -1);
-- 
GitLab