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 <philippe.gorley@savoirfairelinux.com>
diff --git a/web/chatview.html b/web/chatview.html
index 46af2c1..f20f74f 100644
--- a/web/chatview.html
+++ b/web/chatview.html
@@ -865,7 +865,6 @@
* 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 @@
`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 @@
}
}
+ 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)