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

narrow: Mark messages as read when applying -is:dm filter. #25351

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

syed-rafat
Copy link
Collaborator

It will mark messages as read when applying -is:dm filter alone or coupled with stream and topic filters. But it will not mark messages as read when there is also search term present.

fixes #25113.

@zulipbot
Copy link
Member

Hello @zulip/server-search members, this pull request was labeled with the "area: search" label, so you may want to check it out!

@timabbott
Copy link
Member

@syed-rafat thanks for working on this! Can you extend the tests to get back to 100% test coverage on filter.js? This sort of logic is important to have good tests for.

@syed-rafat
Copy link
Collaborator Author

Sure! I am on it.

@syed-rafat thanks for working on this! Can you extend the tests to get back to 100% test coverage on filter.js? This sort of logic is important to have good tests for.

Duly noted, I will extend the test to get 100% coverage.

@zulipbot zulipbot added size: XL and removed size: M labels May 8, 2023
@syed-rafat syed-rafat force-pushed the mark-read-for-private-narrow branch from 39959ac to b5ff6e9 Compare May 8, 2023 12:29
@syed-rafat syed-rafat force-pushed the mark-read-for-private-narrow branch from 6077cb2 to 8c0b7aa Compare May 8, 2023 13:36
@syed-rafat
Copy link
Collaborator Author

@timabbott It is up for review.

@syed-rafat syed-rafat force-pushed the mark-read-for-private-narrow branch 2 times, most recently from 4b3b54e to 80beb9e Compare May 10, 2023 19:27
@alya
Copy link
Contributor

alya commented May 11, 2023

Works for me in manual testing!

@laurynmm Would you be up for doing a round of review on this one?

Copy link
Collaborator

@laurynmm laurynmm left a comment

Choose a reason for hiding this comment

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

@syed-rafat Thanks for working on this!

I made one main comment in the review, but it's just the beginning of looking at what it will take to add these filters to can_mark_messages_read.

The TODO comment above is_common_narrow probably applies here in that it would need to be rewritten to not use the functionality of can_mark_messages_read as a separate prep refactor to these changes. Otherwise, this small change has a much bigger impact and creates some visible bugs.

Let me know if you have any questions about the above and what the next steps would be.

web/src/filter.js Outdated Show resolved Hide resolved

// Excluding direct messages from stream and topic does not
// accomplish anything, but we are still letting user mark
// mark messages as read to be consistent with our design.
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's no need to two duplicate comments here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sorry about that, it slipped during last merge while rebasing.

syed-rafat added a commit to syed-rafat/zulip that referenced this pull request May 24, 2023
core_filters

This a pre commit to prepare for changes in zulip#25351

In web/src/filter, this initial logic is used by both
can_mark_messages_read and is_common_narrow. Changes
related to this pr zulip#25351 breaks is_common_narrow.
As per TODO comment of is_common_narrow, we moved those
filter logics to a core_filters method which is extended
in both of them.
@syed-rafat syed-rafat force-pushed the mark-read-for-private-narrow branch from 80beb9e to 29aa356 Compare May 24, 2023 08:38
@laurynmm
Copy link
Collaborator

@syed-rafat - You're going to want to reorder your commits so that the refactoring pre-commit is first and the other changes are second.

Also, it looks like you forgot that you renamed initial_filters_for_mark_messages_read to core_filters in your refactoring changes. I highly recommend taking the time to review your commits once you push them to Github, because you'll often notice something you missed beforehand.

Finally, you'll want to get all the tests and linters passing. I imagine that missed function rename might be what the linter caught here.

This new method has all the filters that work with both
can_mark_messages_read and is_common_narrow.

This a pre commit to prepare for changes necessary in zulip#25351.

is_common_narrow breaks without this refactor.
It will mark messages as read when applying -is:dm filter alone or
coupled with stream and topic filters. But it will not mark messages as
read when there is also search term present.

Fixes zulip#25113.
@syed-rafat syed-rafat force-pushed the mark-read-for-private-narrow branch from 29aa356 to 97fd8d2 Compare June 2, 2023 16:53
@zulipbot
Copy link
Member

zulipbot commented Jun 2, 2023

Hello @syed-rafat, it seems like you have referenced #25113 in your pull request description, but you have not referenced them in your commit message description(s). Referencing an issue in a commit message automatically closes the corresponding issue when the commit is merged, which makes the issue tracker easier to manage.

Please run git commit --amend in your command line client to amend your commit message description with Fixes #25113..

An example of a correctly-formatted commit:

commit fabd5e450374c8dde65ec35f02140383940fe146
Author: zulipbot
Date:   Sat Mar 18 13:42:40 2017 -0700

    pull requests: Check PR commits reference when issue is referenced.

    Fixes #51.

To learn how to write a great commit message, please refer to our guide.

@zulipbot
Copy link
Member

Heads up @syed-rafat, we just merged some commits that conflict with the changes you 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/main branch and resolve your pull request's merge conflicts accordingly.

@timabbott timabbott force-pushed the main branch 2 times, most recently from 4ec3636 to 88b200c Compare August 18, 2023 23:51
@alya
Copy link
Contributor

alya commented Oct 2, 2023

@syed-rafat do you plan to address the feedback above, or should someone else take over from here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mark messages as read in is:dm and -is:dm search views
5 participants