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

Skip muted_streams/topics in getting next unread topic. #442

Closed
wants to merge 6 commits into from

Conversation

amanagr
Copy link
Member

@amanagr amanagr commented Jul 23, 2019

This PR skips muted topics/streams with n hotkey.

@zulipbot zulipbot added the size: XL [Automatic label added by zulipbot] label Jul 23, 2019
Copy link
Collaborator

@neiljp neiljp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amanagr Good catch on noticing this issue 👍

There's good extra work here in addition to the actual fix for this issue, and not all the elements seem necessary (or complete) for that fix. You could build extra things into this PR, but my thought would be to split this PR into up to 3 PRs:

  • This fix in behavior (1: add tests for existing method, 2: refactor (maybe?), 3/2: fix behavior using existing muting datastructures directly (as elsewhere), extending existing tests
  • Encapsulating muted stream/topic checks, as per the current first commit, but as per my inline comment, incorporating a transition towards the rest of the codebase using that/those methods
  • Moving to use a model_fixture through the code.

Thoughts?

zulipterminal/model.py Outdated Show resolved Hide resolved
@@ -75,6 +76,31 @@ def msg_box(mocker, messages_successful_response):

# --------------- Model Fixtures ----------------------------------------------

@pytest.fixture
def model_fixture(mocker, initial_data, user_profile):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems great at first glance as another standardized fixture, but while you use it in the following commit, you could illustrate its broader use and appeal in this commit by refactoring some other tests using this new fixture.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

zulipterminal/ui_tools/views.py Show resolved Hide resolved
zulipterminal/ui_tools/views.py Show resolved Hide resolved
@amanagr amanagr force-pushed the exclude_muted branch 2 times, most recently from 189e6a0 to 899d116 Compare August 3, 2019 12:54
@zulipbot
Copy link
Member

Heads up @amanagr, 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 upstream/master branch and resolve your pull request's merge conflicts accordingly.

@@ -386,6 +386,19 @@ def fetch_all_topics(self, workers: int) -> None:
if not result]
raise ServerConnectionFailure(", ".join(failures))

def is_muted_stream(self, stream_id: int) -> bool:
if stream_id in self.muted_streams:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be just return stream_id in self.muted_streams.

neiljp added a commit to neiljp/zulip-terminal that referenced this pull request Aug 15, 2022
Logic originally developed by Aman Agrawal (amanagr) in zulip#442.

Updated to take into account:
- already-added (slightly different) is_muted[stream|topic] methods
- migration of get_next_unread_topic into model (simplifying tests)

Also ensure the current behavior is maintained for now by explicitly sorting
the unread counts, which previous relied upon the initial and subsequent data
being ordered.

Tests added.

Co-authored by: Aman Agrawal <f2016561@pilani.bits-pilani.ac.in>
neiljp added a commit to neiljp/zulip-terminal that referenced this pull request Aug 16, 2022
Logic originally developed by Aman Agrawal (amanagr) in zulip#442.

Updated to take into account:
- already-added (slightly different) is_muted[stream|topic] methods
- migration of get_next_unread_topic into model (simplifying tests)

Also ensure the current behavior is maintained for now by explicitly sorting
the unread counts, which previous relied upon the initial and subsequent data
being ordered.

Tests added.

Co-authored by: Aman Agrawal <f2016561@pilani.bits-pilani.ac.in>
neiljp added a commit that referenced this pull request Aug 16, 2022
Logic originally developed by Aman Agrawal (amanagr) in #442.

Updated to take into account:
- already-added (slightly different) is_muted[stream|topic] methods
- migration of get_next_unread_topic into model (simplifying tests)

Also ensure the current behavior is maintained for now by explicitly sorting
the unread counts, which previous relied upon the initial and subsequent data
being ordered.

Tests added.

Co-authored by: Aman Agrawal <f2016561@pilani.bits-pilani.ac.in>
@neiljp
Copy link
Collaborator

neiljp commented Aug 16, 2022

Closing in favor of #1245 (after #1239), which is now merged 🎉

@neiljp neiljp closed this Aug 16, 2022
@amanagr amanagr deleted the exclude_muted branch August 16, 2022 06:14
mounilKshah pushed a commit to mounilKshah/zulip-terminal that referenced this pull request Oct 15, 2022
Logic originally developed by Aman Agrawal (amanagr) in zulip#442.

Updated to take into account:
- already-added (slightly different) is_muted[stream|topic] methods
- migration of get_next_unread_topic into model (simplifying tests)

Also ensure the current behavior is maintained for now by explicitly sorting
the unread counts, which previous relied upon the initial and subsequent data
being ordered.

Tests added.

Co-authored by: Aman Agrawal <f2016561@pilani.bits-pilani.ac.in>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has conflicts size: XL [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants