mirror of
https://github.com/paul-nameless/tg
synced 2024-11-22 11:53:08 +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
|
# last msg haven't been seen by recipient
|
||||||
"unseen": "✓",
|
"unseen": "✓",
|
||||||
"secret": "🔒",
|
"secret": "🔒",
|
||||||
|
"seen": "✓✓", # leave empty if you don't want to see it
|
||||||
}
|
}
|
||||||
MSG_FLAGS = {
|
MSG_FLAGS = {
|
||||||
"selected": "*",
|
"selected": "*",
|
||||||
|
@ -163,6 +164,7 @@ MSG_FLAGS = {
|
||||||
"edited": "E",
|
"edited": "E",
|
||||||
"pending": "...",
|
"pending": "...",
|
||||||
"failed": "💩",
|
"failed": "💩",
|
||||||
|
"seen": "✓✓", # leave empty if you don't want to see it
|
||||||
}
|
}
|
||||||
|
|
||||||
# use this app to open url when there are multiple
|
# 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
|
# last msg haven't been seen by recipient
|
||||||
flags.append("unseen")
|
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):
|
if action_label := _get_action_label(self.model.users, chat):
|
||||||
flags.append(action_label)
|
flags.append(action_label)
|
||||||
|
@ -315,6 +321,11 @@ class MsgView:
|
||||||
):
|
):
|
||||||
if not self.model.is_me(chat["id"]):
|
if not self.model.is_me(chat["id"]):
|
||||||
flags.append("unseen")
|
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"):
|
if state := msg_proxy.msg.get("sending_state"):
|
||||||
log.info("state: %s", state)
|
log.info("state: %s", state)
|
||||||
state_type = state["@type"]
|
state_type = state["@type"]
|
||||||
|
|
Loading…
Reference in a new issue