Merge pull request #181 from paul-nameless/add-seen-flag

Add seen flag
This commit is contained in:
Nameless 2020-09-22 09:50:38 +03:00 committed by GitHub
commit 4a2569b12b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -154,6 +154,7 @@ CHAT_FLAGS = {
# last msg haven't been seen by recipient
"unseen": "✓",
"secret": "🔒",
"seen": "✓✓", # leave empty if you don't want to see it
}
MSG_FLAGS = {
"selected": "*",
@ -163,6 +164,7 @@ MSG_FLAGS = {
"edited": "E",
"pending": "...",
"failed": "💩",
"seen": "✓✓", # leave empty if you don't want to see it
}
# use this app to open url when there are multiple

View file

@ -246,6 +246,12 @@ class ChatView:
):
# last msg haven't been seen by recipient
flags.append("unseen")
elif (
msg
and self.model.is_me(msg["sender_user_id"])
and msg["id"] <= chat["last_read_outbox_message_id"]
):
flags.append("seen")
if action_label := _get_action_label(self.model.users, chat):
flags.append(action_label)
@ -315,6 +321,11 @@ class MsgView:
):
if not self.model.is_me(chat["id"]):
flags.append("unseen")
elif (
self.model.is_me(msg_proxy.sender_id)
and msg_proxy.msg_id <= chat["last_read_outbox_message_id"]
):
flags.append("seen")
if state := msg_proxy.msg.get("sending_state"):
log.info("state: %s", state)
state_type = state["@type"]