-
-
Notifications
You must be signed in to change notification settings - Fork 277
Handle read events from server #535
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
base: main
Are you sure you want to change the base?
Conversation
@kaustubh-nair I know this is WIP, but continuing this work would be helpful to reliably track unread counts, depending on how busy you are with other things right now. |
@neiljp I was just finishing up with the typeahead footer PR, I'll be working on this one now. |
dddefc9
to
d339854
Compare
5687b88
to
4378646
Compare
9d7ba6c
to
02eba43
Compare
18bfb3c
to
4d04157
Compare
|
||
# If we sent this message, don't increase the count | ||
if user_id == controller.model.user_id: | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kind of hacky - we don't have sender_id
for stream messages in initial_data['unread_msgs']
Though on close inspection this piece of code doesn't seem to be doing anything?
Refer to conversation on czo https://chat.zulip.org/#narrow/stream/206-zulip-terminal/topic/Handling.20read.20events/near/845434
2a628e7
to
06ddfb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaustubh-nair The PR title refers to 'handle read events', and in this sense it seems to work well 👍
I didn't anticipate the approach you've taken - rather messages+unread being handled separately in each case where they would be updated.
Functionality while it's not strictly part of the PR intent, it would seem good to handle the addition (append'ing) of messages too.
I'm wary that we're ending up with two datastructures which hold overlapping information, and in some cases lots of duplicate information.
I also get a bug where changed_messages
(helper.py, L191) has a KeyError
(id not in messages, presumably) in some cases.
I'm concerned by the change of the elif
statement for 1-1 pms
etc, but we can look into that - I've not dug deep into that.
@neiljp Thanks for the review! Last two commits can be squashed later; I've kept them separate for now. |
b4cdf24
to
eb71b54
Compare
@kaustubh-nair I'm still getting tracebacks in this PR; I've not read through it again in detail though, so can't make further comments at this stage. |
Add 'unread_msgs' attribute in index to store all data pertaining to unread messages obtained from initial_data. Modify classify_unread_counts to return this unread_msgs data structure. Tests amended.
Per-message 'sender_id' is not available for stream messages. Due to this, messages sent by user might cause undesirable behaviours.
Entries are added to unread message datastructure when new messsages are added, so that unread count can be updated. Tests amended.
Heads up @kaustubh-nair, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the |
@kaustubh-nair can I take this up if you are not planning to continue work on this? |
TODO: