From 0d1f7cafcd9db3ffff8e22f898005dc34bca5fcb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 11 Mar 2023 13:49:28 +0200 Subject: SL-19109 Fix item updates not getting a callback --- indra/newview/llaisapi.cpp | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp index 3826da0341..8e20132ede 100644 --- a/indra/newview/llaisapi.cpp +++ b/indra/newview/llaisapi.cpp @@ -483,20 +483,17 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht gInventory.onAISUpdateReceived("AISCommand", result); if (callback && !callback.empty()) - { + { + bool needs_callback = true; LLUUID id(LLUUID::null); - if (type == COPYLIBRARYCATEGORY) - { - if (result.has("category_id")) - { - id = result["category_id"]; - } //else signal failure - callback(id); + if (type == COPYLIBRARYCATEGORY && result.has("category_id")) + { + id = result["category_id"]; } if (type == CREATEINVENTORY) { - bool informed_caller = false; + // CREATEINVENTORY can have multiple callbacks if (result.has("_created_categories")) { LLSD& cats = result["_created_categories"]; @@ -505,7 +502,7 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht { LLUUID cat_id = *cat_iter; callback(cat_id); - informed_caller = true; + needs_callback = false; } } if (result.has("_created_items")) @@ -516,17 +513,17 @@ void AISAPI::InvokeAISCommandCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t ht { LLUUID item_id = *item_iter; callback(item_id); - informed_caller = true; + needs_callback = false; } } - - if (!informed_caller) - { - // signal failure with null id - callback(id); - } } + if (needs_callback) + { + // Call callback at least once regardless of failure. + // UPDATEITEM doesn't expect an id + callback(id); + } } } -- cgit v1.2.3