Closed yangsheng6810 closed 2 years ago
The offending part seems to be in function telega--on-initial-chats-load
, where when (telega-msg-run-ignore-predicates last-message 'last-msg)
returns t, an update of the chat is called. This seems to mark everything as read.
In case anyone finds it useful, here is my workaround:
(define-advice telega--on-updateNewMessage (:around (func event) wrap)
(define-advice telega-msg-run-ignore-predicates (:filter-return (ret) wrap) nil)
(funcall func event)
(advice-remove #'telega-msg-run-ignore-predicates
#'telega-msg-run-ignore-predicates@wrap))
This is actually a "feature", here is a comment about it:
;; NOTE: View ignored message, so modeline/appindicator
;; won't show there is something important if ignored
;; message contains mention
But yeah, you are right, we should not implicitly view ignored message. Better to just delete it for me only in group chats, I'll add customization for this
I think the "feature" is that if some ignored message is considered important or contains a mention, then such important/mention shall also be ignored. However, the current implementation achieves this by viewing the ignored message, which causes previously unread messages from other users to also be considered read. I assume an ideal implementation of this feature would achieve the following:
If this is not achievable, maybe add some customization for this? I am personally OK if I see some phantom mentions which disappear when I view the chat, but maybe not everyone likes this.
None of 1. or 2. is achievable, unfortunately. The best solution I'm experimenting with right now is to mark all mentions as read if there are no other mentions in the chat and only a single mention exists in the ignored message.
Should be fixed in the master, please check
And thank you for the report!
Seems to work for me. Thanks!
Telega Setup
OS: Arch Linux Emacs: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) Telega: telega v0.7.70 (TDLib v1.7.7) (telega-server v0.7.13)
Current Behavior
I have the following setting in my config to filter out blocked users in group chats:
Usually, when someone posts a message in a group chat, it is considered as unread before I open that particular chat. With no chat opened, I can see the number of unread messages from
*Telega Root*
, and while new messages are sent to that chat by other users, the number of unread messages increases. Everything is fine until a message is sent by a user blocked by me. When such a message is sent, all unread messages in that group chat are marked as read, and the number of unread messages resets to zero. I checked with telega and other Telegram clients, and those unread messages are indeed considered as read by the system, i.e. opening up the chat and we will see that the first unread message is the one right after the message sent by the blocked user (note this message by the blocked user is not visible in telega unless you removetelega-msg-from-blocked-sender-p
fromtelega-msg-ignore-predicates
).Steps to Reproduce
(add-hook 'telega-msg-ignore-predicates #'telega-msg-from-blocked-sender-p)
*Telega Root*
with no chat opened.