mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-10-26 02:48:47 -04:00
show if a conversation has failed outbound messages
This commit is contained in:
parent
929af755df
commit
d90e799019
2 changed files with 13 additions and 1 deletions
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -313,12 +313,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="mr-auto">
|
||||
<div class="text-gray-900" :class="{ 'font-semibold': conversation.is_unread }">{{ conversation.name }}</div>
|
||||
<div class="text-gray-900" :class="{ 'font-semibold': conversation.is_unread || conversation.failed_messages_count > 0 }">{{ conversation.name }}</div>
|
||||
<div class="text-gray-500 text-sm">{{ formatTimeAgo(conversation.updated_at) }}</div>
|
||||
</div>
|
||||
<div v-if="conversation.is_unread" class="my-auto ml-2 mr-2">
|
||||
<div class="bg-blue-500 rounded-full p-1"></div>
|
||||
</div>
|
||||
<div v-else-if="conversation.failed_messages_count" class="my-auto ml-2 mr-2">
|
||||
<div class="bg-red-500 rounded-full p-1"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="mx-auto my-auto text-center leading-5">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue