Sort unread topics by recency for n shortcut.#1625
Open
archie-2006 wants to merge 1 commit intozulip:mainfrom
Open
Sort unread topics by recency for n shortcut.#1625archie-2006 wants to merge 1 commit intozulip:mainfrom
archie-2006 wants to merge 1 commit intozulip:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1582.
What does this PR do, and why?
Before, using the
nkeybinding (NEXT_UNREAD_TOPIC) jumps to the next unread topic alphabetically within a stream. But it should be sorting unread topics by recency.this pull request fixes this issue #1582 by using recency-based sorting
helper.py: Updatedsort_unread_topicsto accept an optionaltopic_msg_idsdictionary. Modified the sortingkeyto evaluate the maximummessage_idwithin each topic (-max(...)), ensuring that the most recently active topics go to the top (bubble). The alphabetical topic name sorting (from earlier) is still being used as a secondary tie breaker.model.py: Updated calls tosort_unread_topicsinnext_unread_topic_from_message_idto passself.index["topic_msg_ids"]External discussion & connections
topicnshould move between topics by recency #1582How did you test this?
Self-review checklist for each commit
Visual Changes
Navigating with
nin Explore mode. The selection correctly jumps from the recently active(checkmark) testtopic to the next most recent unread topic (test), rather than sorting alphabetically, like earlier.The header shows being in the test checkmark in the first screenshot (this is before pressing n)
In the second ss, after pressing n, the ui changes and the header now shows test without the checkmark and the message history of unread messages for that topic beneath it.