diff --git a/modules/ui_chat_runtime/src/chat_delivery_feedback_controller.cpp b/modules/ui_chat_runtime/src/chat_delivery_feedback_controller.cpp index f2911909..4a0e8f25 100644 --- a/modules/ui_chat_runtime/src/chat_delivery_feedback_controller.cpp +++ b/modules/ui_chat_runtime/src/chat_delivery_feedback_controller.cpp @@ -14,7 +14,18 @@ void ChatDeliveryFeedbackController::onChatSendResult( bool success, const chat::ChatMessage* message) { - if (msg_id == 0 || message == nullptr || message->from != 0) + if (msg_id == 0) + { + return; + } + if (message == nullptr) + { + if (success) + { + return; + } + } + else if (message->from != 0) { return; } diff --git a/modules/ui_chat_runtime/tests/test_chat_delivery_feedback_controller.cpp b/modules/ui_chat_runtime/tests/test_chat_delivery_feedback_controller.cpp index 774e61f5..6780b66f 100644 --- a/modules/ui_chat_runtime/tests/test_chat_delivery_feedback_controller.cpp +++ b/modules/ui_chat_runtime/tests/test_chat_delivery_feedback_controller.cpp @@ -68,7 +68,14 @@ int main() controller.onChatSendResult(103, false, nullptr); controller.onChatSendResult(0, false, &failed); assert(port.sent_count == 1); - assert(port.failed_count == 1); + assert(port.failed_count == 2); + assert(port.last_id == 103); + + controller.onChatSendResult(103, false, nullptr); + assert(port.failed_count == 2); + + controller.onChatSendResult(104, true, nullptr); + assert(port.sent_count == 1); controller.clear(); controller.onChatSendResult(100, true, &sent);