feat(backend): read time of my messages from the archive, exact dates and group readers asked from telegram on demand
This commit is contained in:
1 parent
f27943aae6
commit
d8dd08d7de
10 files changed
+497
-9
No files matched your search
@@ -10,7 +10,7 @@ from utils.read.models import (
|
||||
MessageView,
|
||||
Page,
|
||||
)
|
||||
from utils.read.read_receipts import read_up_to
|
||||
from utils.read.read_receipts import read_times, read_up_to
|
||||
|
||||
_MESSAGE_COLS = (
|
||||
"chat_id, message_id, date, sender_id, text, has_media, is_self_destruct, "
|
||||
@@ -285,12 +285,18 @@ async def _apply_read_status(
|
||||
self_id = await self_user_id(pool, account_id)
|
||||
if self_id is None:
|
||||
return
|
||||
marker = await read_up_to(pool, account_id, chat_id)
|
||||
if marker is None:
|
||||
own = [view for view in views if view.sender_id == self_id]
|
||||
if not own:
|
||||
return
|
||||
for view in views:
|
||||
if view.sender_id == self_id and view.message_id <= marker:
|
||||
view.read = True
|
||||
marker = await read_up_to(pool, account_id, chat_id)
|
||||
times = await read_times(
|
||||
pool, account_id, chat_id, [(view.message_id, view.date) for view in own]
|
||||
)
|
||||
for view in own:
|
||||
view.read_at = times.get(view.message_id)
|
||||
view.read = view.read_at is not None or (
|
||||
marker is not None and view.message_id <= marker
|
||||
)
|
||||
|
||||
|
||||
def _build_album(
|
||||
|
||||
Reference in new issue
Block a user