mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 03:43:19 +00:00
Add seen flag
This commit is contained in:
parent
c38b1186d1
commit
f315411e56
2 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
11
tg/views.py
11
tg/views.py
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue