Commit 04ac84b1 authored by Sébastien Blin's avatar Sébastien Blin Committed by Philippe Gorley
Browse files

chatview: add the ability to retry to send interactions



Add a retry button for failed file transfers and text messages

Change-Id: I29cf6ee87a747855515a6da384a6ef6b5aa82e5e
Reviewed-by: Philippe Gorley's avatarPhilippe Gorley <philippe.gorley@savoirfairelinux.com>
parent d2ea6ddc
......@@ -279,6 +279,14 @@ webkit_chat_container_script_dialog(GtkWidget* webview, gchar *interaction, Chat
} catch (...) {
g_warning("delete interaction failed: can't find %s", order.substr(std::string("DELETE_INTERACTION:").size()).c_str());
}
} else if (order.find("RETRY_INTERACTION:") == 0) {
try {
auto interactionId = std::stoull(order.substr(std::string("RETRY_INTERACTION:").size()));
if (!priv->conversation_) return;
(*priv->accountInfo_)->conversationModel->retryInteraction(priv->conversation_->uid, interactionId);
} catch (...) {
g_warning("delete interaction failed: can't find %s", order.substr(std::string("RETRY_INTERACTION:").size()).c_str());
}
}
}
......
......@@ -865,7 +865,6 @@ function textInteraction(message_id, htmlText) {
* Update a text interaction (text)
* @param message_div the message to update
* @param delivery_status the status of the message
* @TODO retry button
*/
function updateTextInteraction(message_div, delivery_status) {
if (!message_div.querySelector(".message_text")) return // media
......@@ -1109,13 +1108,16 @@ function addOrUpdateMessage(message_object, new_message, insert_after = true) {
`dropdown_${message_id}`
]
dropdown.setAttribute("class", dropdown_classes.join(" "))
const remove = document.createElement("div")
remove.setAttribute("class", "delete")
remove.innerHTML = "Delete"
remove.msg_id = message_id
remove.onclick = function() {
window.prompt(`DELETE_INTERACTION:${this.msg_id}`)
}
dropdown.appendChild(remove)
menu_element.appendChild(dropdown)
if (message_type !== "call") {
message_div.appendChild(menu_element)
......@@ -1158,6 +1160,17 @@ function addOrUpdateMessage(message_object, new_message, insert_after = true) {
}
}
if (isErrorStatus(delivery_status) && message_direction === "out") {
const dropdown = document.querySelector(`.dropdown_${message_id}`)
const retry = document.createElement("div")
retry.innerHTML = "Retry"
retry.msg_id = message_id
retry.onclick = function() {
window.prompt(`RETRY_INTERACTION:${this.msg_id}`)
}
dropdown.insertBefore(retry, message_div.querySelector(".delete"))
}
// Update informations if needed
if (message_type === "data_transfer")
updateFileInteraction(message_div, message_object)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment