Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Archive-Link ChatListItem should get some kind of chat changed event when its unread counter should change #3940

Closed
Simon-Laux opened this issue Jan 9, 2023 · 3 comments · Fixed by #3959
Assignees
Labels
bug Something is not working

Comments

@Simon-Laux
Copy link
Member

the archive link pseudo chat list item now has an unread count, this unread count should have event for when it needs to be updated. otherwise desktop won't update it, or with a workaround it will update it too often (if it refetches the item on every incoming message event).

I propose that we emit the ChatChanged event for chatid 6 (DC_CHAT_ID_ARCHIVED_LINK), when we have an incoming message in a muted, archived chat. Ideal only if we did not already had an unread message in that chat, as the unread count on the archive link is not the count of messages, but of chats that have unread messages.

@Simon-Laux Simon-Laux changed the title Archive-Link ChatListItem should get some kind of chat changed event when it's unread counter should change Archive-Link ChatListItem should get some kind of chat changed event when its unread counter should change Jan 9, 2023
@Simon-Laux Simon-Laux added the bug Something is not working label Jan 9, 2023
@r10s
Copy link
Member

r10s commented Jan 11, 2023

maybe MsgsChanged with chatId=DC_CHAT_ID_ARCHIVED_LINK and msgId=0 fits better as this is also the event where usually the other counters are updated.

(ChatChanged is about group name, image memberlist, however, if better fitting in desktop somehow, of course, we can also document that explicitly for the archived-link - or even create an explicit event for the archived-link)

@iequidoo iequidoo self-assigned this Jan 11, 2023
@Simon-Laux
Copy link
Member Author

Do what works best, MsgsChanged event is also fine, I'm working on a pr that adds events specifically for chatlist updates (which I'm planning to migrate desktop to), so as soon as there is logic for emitting any event (with chat id= DC_CHAT_ID_ARCHIVED_LINK) in this case it's sufficient for me, because adding another event using the same data in my new pr is trivial.

iequidoo added a commit that referenced this issue Jan 15, 2023
…er of archived chats with

unread messages increases (#3940)
iequidoo added a commit that referenced this issue Jan 15, 2023
…er of archived chats with

unread messages increases (#3940)
iequidoo added a commit that referenced this issue Jan 15, 2023
…er of archived chats with

unread messages increases (#3940)
iequidoo added a commit that referenced this issue Jan 16, 2023
…er of archived chats with

unread messages increases (#3940)
iequidoo added a commit that referenced this issue Jan 16, 2023
…er of archived chats with

unread messages increases (#3940)
iequidoo added a commit that referenced this issue Jan 16, 2023
…er of archived chats with

unread messages increases (#3940)
@r10s
Copy link
Member

r10s commented Jan 17, 2023

[...] or with a workaround it will update it too often (if it refetches the item on every incoming message event).

just stumbled upon that: it could have been smarter even without #3950, however, i also forgot about the the relatively new DC_EVENT_INCOMING_MSG_BUNCH, that would probably also have been "good enough".

however with #3950 things are better than "good enough" :)

imu, however, for a decreasing counter, you still have to listen to DC_EVENT_MSGS_NOTICED, ignoring the chat-id.

iequidoo added a commit that referenced this issue Jul 11, 2024
… decrease (#5768)

Follow-up to 3cf7874 "Emit DC_EVENT_MSGS_CHANGED for
DC_CHAT_ID_ARCHIVED_LINK when the number of archived chats with unread messages increases (#3940)".

In general we don't want to make an extra db query to know if a noticied chat is
archived. Emitting events should be cheap, better to allow false-positive `MsgsChanged` events.
iequidoo added a commit that referenced this issue Jul 22, 2024
… decrease (#5768)

Follow-up to 3cf7874 "Emit DC_EVENT_MSGS_CHANGED for
DC_CHAT_ID_ARCHIVED_LINK when the number of archived chats with unread messages increases (#3940)".

In general we don't want to make an extra db query to know if a noticied chat is
archived. Emitting events should be cheap, better to allow false-positive `MsgsChanged` events.
iequidoo added a commit that referenced this issue Jul 22, 2024
… decrease (#5768)

Follow-up to 3cf7874 "Emit DC_EVENT_MSGS_CHANGED for
DC_CHAT_ID_ARCHIVED_LINK when the number of archived chats with unread messages increases (#3940)".

In general we don't want to make an extra db query to know if a noticied chat is
archived. Emitting events should be cheap, better to allow false-positive `MsgsChanged` events.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment