Skip to content

msglist: Tapping a message in Starred or Mentions opens anchored msglist #1657

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

Merged
merged 2 commits into from
Jul 3, 2025

Conversation

chrisbobbe
Copy link
Collaborator

Fixes #1621.

Adapted from the similar test for tapping the topic:
> 'navigates to TopicNarrow on tapping topic in ChannelNarrow'
@chrisbobbe chrisbobbe requested a review from gnprice July 2, 2025 21:46
@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Jul 2, 2025
@chrisbobbe
Copy link
Collaborator Author

chrisbobbe commented Jul 2, 2025

(fixing CI; just an unused import.)

@chrisbobbe chrisbobbe force-pushed the pr-tap-msg-open-conversation branch from 75caabe to f35dc2a Compare July 2, 2025 22:51
Copy link
Member

@gnprice gnprice left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good; small comments below.

Comment on lines 1354 to 1357
MessageListMessageItem() => MessageWithPossibleSender(
item: item,
tapOpensConversation: tapOpensConversation,
),
Copy link
Member

Choose a reason for hiding this comment

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

nit: item is the payload, tapOpensConversation is metadata, so keep the payload last in the widget constructor's parameter list

Comment on lines 979 to 984
/// Whether tapping a message should open its conversation.
bool get _tapMessageOpensConversation => switch (widget.narrow) {
CombinedFeedNarrow()
|| ChannelNarrow()
|| TopicNarrow()
|| DmNarrow() => false,
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think it's probably cleaner to have this logic live next to where it gets used, on MessageWithPossibleSender; so instead of passing down the bool this returns, we'd pass down the Narrow itself. Just like we do with RecipientHeader now.

check(lastPushedRoute).isNull();
}

// TODO test tapping whitespace in message
Copy link
Member

Choose a reason for hiding this comment

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

I guess this TODO test is the one that would fail if the HitTestBehavior.translucent were changed to deferToChild.

Leaving a TODO seems fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah; I timed out trying to simulate tapping the back button to clear the state from the previous part of the test (find.backButton() wasn't working)

Comment on lines 1716 to 1719
doTest(CombinedFeedNarrow(), false, mkMessage: () => eg.streamMessage());
doTest(ChannelNarrow(subscription.streamId), false,
mkMessage: () => eg.streamMessage(stream: subscription));
doTest(TopicNarrow(subscription.streamId, eg.t(topic)), false,
Copy link
Member

Choose a reason for hiding this comment

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

nit: can I think clarify by reformatting slightly:

Suggested change
doTest(CombinedFeedNarrow(), false, mkMessage: () => eg.streamMessage());
doTest(ChannelNarrow(subscription.streamId), false,
mkMessage: () => eg.streamMessage(stream: subscription));
doTest(TopicNarrow(subscription.streamId, eg.t(topic)), false,
doTest(expected: false, CombinedFeedNarrow(),
mkMessage: () => eg.streamMessage());
doTest(expected: false, ChannelNarrow(subscription.streamId),
mkMessage: () => eg.streamMessage(stream: subscription));
doTest(expected: false, TopicNarrow(subscription.streamId, eg.t(topic)),
  • name the boolean parameter, so its meaning is clear;
  • put the short, near-constant-width argument first, so corresponding arguments are aligned;
  • put this mkMessage on the next line, to match the others.

@chrisbobbe chrisbobbe force-pushed the pr-tap-msg-open-conversation branch from f35dc2a to a922f56 Compare July 3, 2025 01:14
@chrisbobbe
Copy link
Collaborator Author

Thanks for the review! Revision pushed.

@gnprice
Copy link
Member

gnprice commented Jul 3, 2025

Thanks! Looks good; merging.

@gnprice gnprice merged commit a922f56 into zulip:main Jul 3, 2025
1 check passed
@chrisbobbe chrisbobbe deleted the pr-tap-msg-open-conversation branch July 3, 2025 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

msglist: When tapping a message in starred/mentions/search, open conversation view at that message
2 participants