diff --git a/meshchat.py b/meshchat.py index e39be59..47853c2 100644 --- a/meshchat.py +++ b/meshchat.py @@ -1051,6 +1051,7 @@ class ReticulumMeshChat: "name": self.get_lxmf_conversation_name(other_user_hash), "destination_hash": other_user_hash, "is_unread": self.is_lxmf_conversation_unread(other_user_hash), + "failed_messages_count": self.lxmf_conversation_failed_messages_count(other_user_hash), # we say the conversation was updated when the latest message was created # otherwise this will go crazy when sending a message, as the updated_at on the latest message changes very frequently "updated_at": created_at, @@ -1809,6 +1810,14 @@ class ReticulumMeshChat: conversation_latest_message_at = datetime.strptime(latest_incoming_lxmf_message.created_at, "%Y-%m-%d %H:%M:%S.%f%z") return conversation_last_read_at < conversation_latest_message_at + # returns number of messages that failed to send in a conversation + def lxmf_conversation_failed_messages_count(self, destination_hash: str): + return (database.LxmfMessage.select() + .where(database.LxmfMessage.state == "failed") + .where(database.LxmfMessage.destination_hash == destination_hash) + .count()) + + # class to manage config stored in database class Config: diff --git a/public/index.html b/public/index.html index d70df0a..3bb3639 100644 --- a/public/index.html +++ b/public/index.html @@ -313,12 +313,15 @@
-
{{ conversation.name }}
+
{{ conversation.name }}
{{ formatTimeAgo(conversation.updated_at) }}
+
+
+