Skip to content

Conversation

@sm-sayedi
Copy link
Collaborator

@sm-sayedi sm-sayedi commented Jan 20, 2026

Fixes: #2088

Searched for the occurrences using topic (!|=)= regex.

Notable commits

b35168d msglist: Use isSameAs for topic comparison in UserTopicEvent handling

Previously, when a UserTopicEvent muted a topic, only messages whose
topic matched the event topic exactly (case-sensitive) were removed.
Now, messages from all topics whose casing is different from the event
topic, are removed.

28ecbb2 msglist: Use isSameAs for topic comparison in message-move handling

Prior to this, when focusing on a topic narrow (e.g. for topic "t"),
message moves would be handled in the following way:

  • Messages moved from narrow: If messages were moved from topic "T",
    they wouldn't be removed from the current message list.
  • Messages moved into narrow: If messages were moved into topic "T",
    they wouldn't show up in the current message list.
  • Messages moved inside narrow:
    • If messages were moved from topic "t" into topic "T", they would
      be removed from the current message list.
    • If messages were moved into topic "t" from topic "T", there
      would be an unnecessary refetch.

ec57b6f narrow: Use isSameAs for topic comparison in TopicNarrow.==

Prior to this, when focusing on a topic narrow (e.g. for topic "t"),
opening a notification for a message of topic "T" would open a new page
on top of the current one for the same narrow. Now, it's deduped.

@sm-sayedi sm-sayedi added the maintainer review PR ready for review by Zulip maintainers label Jan 20, 2026
@sm-sayedi sm-sayedi requested a review from chrisbobbe January 20, 2026 13:24
@sm-sayedi sm-sayedi force-pushed the 2088-accurate-topic-comparison branch 2 times, most recently from ec57b6f to 3f1ae13 Compare January 23, 2026 04:07
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Small comments below.

Comment on lines 1022 to 1023
StreamDestination(stream.streamId, eg.t(topic)),
StreamDestination(stream.streamId, eg.t(topic.toUpperCase())),
Copy link
Collaborator

Choose a reason for hiding this comment

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

If topic and topic.toUpperCase() happened to be identical, then we'd lose coverage of the case-insensitivity check, which means a reader has to check and make sure topic won't be something like "TOPIC" or "" or "中文" or something. How about using literal strings, inline, to remove this need for nonlocal reasoning? Like for example "abc" and "ABC".

Comment on lines +1836 to +1837
// checkNotNotified();
checkNotifiedOnce(); // unrelated; from notifyListenersIfAnyMessagePresent
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm confused; what's the expected and desired behavior about notifying listeners 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.

The expected behavior here is that the message move itself in this case shouldn't cause notifying listeners, because messages are moved from "topic" to "ToPiC" in the same channel, which means they're still in the same narrow and in the same position compared to other messages in the narrow. But here, the notification comes from notifyListenersIfAnyMessagePresent.

This test is about stream/channel narrow and compares parts of the test
behavior with the combined feed, not the stream/channel narrow itself.
Previously, when a UserTopicEvent muted a topic, only messages whose
topic matched the event topic exactly (case-sensitive) were removed.
Now, messages from all topics whose casing is different from the event
topic, are removed.
Prior to this, when focusing on a topic narrow (e.g. for topic "t"),
message moves would be handled in the following way:

  - Messages moved from narrow: If messages were moved from topic "T",
    they wouldn't be removed from the current message list.
  - Messages moved into narrow: If messages were moved into topic "T",
    they wouldn't show up in the current message list.
  - Messages moved inside narrow:
      - If messages were moved from topic "t" into topic "T", they would
        be removed from the current message list.
      - If messages were moved into topic "t" from topic "T", there
        would be an unnecessary refetch.
Prior to this, when focusing on a topic narrow (e.g. for topic "t"),
opening a notification for a message of topic "T" would open a new page
on top of the current one for the same narrow. Now, it's deduped.

Fixes: zulip#2088
@sm-sayedi sm-sayedi force-pushed the 2088-accurate-topic-comparison branch from 3f1ae13 to 5005d31 Compare January 27, 2026 22:00
@sm-sayedi
Copy link
Collaborator Author

Thanks for the review. Pushed changes, PTAL.

@sm-sayedi sm-sayedi requested a review from chrisbobbe January 27, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer review PR ready for review by Zulip maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use TopicName.isSameAs instead of == for topic comparisons, where appropriate

2 participants