diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 20 | ||||
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 25 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 2 |
4 files changed, 31 insertions, 21 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 810b873624..5bdd5bc8f8 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -583,21 +583,17 @@ void LLFloaterAssociateListing::apply(BOOL user_confirm) // Check if the id exists in the merchant SLM DB: note that this record might exist in the LLMarketplaceData // structure even if unseen in the UI, for instance, if its listing_uuid doesn't exist in the merchant inventory LLUUID listing_uuid = LLMarketplaceData::instance().getListingFolder(id); - if (listing_uuid.notNull()) + if (listing_uuid.notNull() && user_confirm && LLMarketplaceData::instance().getActivationState(listing_uuid)) { - // Look for user confirmation when unlisting something - if (user_confirm) - { - LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLFloaterAssociateListing::callback_apply, this, _1, _2)); - return; - } - // Unlist the id if it exists in the merchant SLM DB - LLMarketplaceData::instance().activateListing(listing_uuid, false); - // Clear its version folder - LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null); + // Look for user confirmation before unlisting + LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLFloaterAssociateListing::callback_apply, this, _1, _2)); + return; } // Associate the id with the user chosen folder - LLMarketplaceData::instance().associateListing(mUUID,id); + LLMarketplaceData::instance().associateListing(mUUID,listing_uuid,id); + // Update the folder widgets now that the action is launched + update_marketplace_category(listing_uuid); + update_marketplace_category(mUUID); } } closeFloater(); diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 6986ac664f..3925bcda02 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -153,6 +153,11 @@ void update_marketplace_category(const LLUUID& cur_uuid, bool perform_consistenc // is limited to 4. // We also take care of degenerated cases so we don't update all folders in the inventory by mistake. + if (cur_uuid.isNull()) + { + return; + } + // Grab marketplace listing data for this item S32 depth = depth_nesting_in_marketplace(cur_uuid); if (depth > 0) diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index c453b236cd..650b587091 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -460,15 +460,17 @@ class LLSLMAssociateListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMAssociateListingsResponder); public: - LLSLMAssociateListingsResponder(const LLUUID& folder_id) + LLSLMAssociateListingsResponder(const LLUUID& folder_id, const LLUUID& source_folder_id) { mExpectedFolderId = folder_id; + mSourceFolderId = source_folder_id; } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + LLMarketplaceData::instance().setUpdating(mSourceFolderId,false); LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; @@ -479,6 +481,7 @@ public: { log_SLM_warning("Put /associate_inventory", getStatus(), getReason(), "", body); update_marketplace_category(mExpectedFolderId, false); + update_marketplace_category(mSourceFolderId, false); gInventory.notifyObservers(); return; } @@ -489,6 +492,7 @@ public: { log_SLM_warning("Put /associate_inventory", getStatus(), "Json parsing failed", reader.getFormatedErrorMessages(), body); update_marketplace_category(mExpectedFolderId, false); + update_marketplace_category(mSourceFolderId, false); gInventory.notifyObservers(); return; } @@ -524,9 +528,13 @@ public: LLMarketplaceData::instance().setListingURL(folder_id, edit_url); it++; } + + // Always update the source folder so its widget updates + update_marketplace_category(mSourceFolderId, false); } private: - LLUUID mExpectedFolderId; + LLUUID mExpectedFolderId; // This is the folder now associated with the id. + LLUUID mSourceFolderId; // This is the folder initially associated with the id. Can be LLUUI::null }; class LLSLMDeleteListingsResponder : public LLHTTPClient::Responder @@ -1223,7 +1231,7 @@ void LLMarketplaceData::updateSLMListing(const LLUUID& folder_id, S32 listing_id LLHTTPClient::putRaw(url, data, size, new LLSLMUpdateListingsResponder(folder_id, is_listed, version_id), headers); } -void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id) +void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& source_folder_id) { LLSD headers = LLSD::emptyMap(); headers["Accept"] = "application/json"; @@ -1234,8 +1242,9 @@ void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing // Note : we're assuming that sending unchanged info won't break anything server side... root["listing"]["id"] = listing_id; + root["listing"]["is_listed"] = false; root["listing"]["inventory_info"]["listing_folder_id"] = folder_id.asString(); - root["listing"]["inventory_info"]["version_folder_id"] = version_id.asString(); + root["listing"]["inventory_info"]["version_folder_id"] = LLUUID::null.asString(); std::string json_str = writer.write(root); @@ -1248,7 +1257,8 @@ void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing std::string url = getSLMConnectURL("/associate_inventory/") + llformat("%d",listing_id); log_SLM_infos("LLHTTPClient::putRaw", url, json_str); setUpdating(folder_id,true); - LLHTTPClient::putRaw(url, data, size, new LLSLMAssociateListingsResponder(folder_id), headers); + setUpdating(source_folder_id,true); + LLHTTPClient::putRaw(url, data, size, new LLSLMAssociateListingsResponder(folder_id,source_folder_id), headers); } void LLMarketplaceData::deleteSLMListing(S32 listing_id) @@ -1403,7 +1413,7 @@ bool LLMarketplaceData::setVersionFolder(const LLUUID& folder_id, const LLUUID& return true; } -bool LLMarketplaceData::associateListing(const LLUUID& folder_id, S32 listing_id) +bool LLMarketplaceData::associateListing(const LLUUID& folder_id, const LLUUID& source_folder_id, S32 listing_id) { if (isListed(folder_id)) { @@ -1412,8 +1422,7 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, S32 listing_id } // Post the listing update request to SLM - LLUUID version_id; - associateSLMListing(folder_id, listing_id, version_id); + associateSLMListing(folder_id, listing_id, source_folder_id); return true; } diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index e087139a3d..85e60c04a2 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -192,7 +192,7 @@ public: bool activateListing(const LLUUID& folder_id, bool activate); bool clearListing(const LLUUID& folder_id); bool setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id); - bool associateListing(const LLUUID& folder_id, S32 listing_id); + bool associateListing(const LLUUID& folder_id, const LLUUID& source_folder_id, S32 listing_id); bool getListing(const LLUUID& folder_id); // Probe the Marketplace data set to identify folders |