mirror of https://github.com/zulip/zulip.git
message: Do not differentiate topics by case when aggregating.
This commit is contained in:
parent
a8304fb324
commit
ed8058d060
|
@ -730,7 +730,7 @@ def aggregate_streams(*, input_dict: dict[int, RawUnreadStreamDict]) -> list[Unr
|
||||||
for message_id, attribute_dict in input_dict.items():
|
for message_id, attribute_dict in input_dict.items():
|
||||||
stream_id = attribute_dict["stream_id"]
|
stream_id = attribute_dict["stream_id"]
|
||||||
topic_name = attribute_dict["topic"]
|
topic_name = attribute_dict["topic"]
|
||||||
lookup_key = (stream_id, topic_name)
|
lookup_key = (stream_id, topic_name.lower())
|
||||||
if lookup_key not in lookup_dict:
|
if lookup_key not in lookup_dict:
|
||||||
obj = UnreadStreamInfo(
|
obj = UnreadStreamInfo(
|
||||||
stream_id=stream_id,
|
stream_id=stream_id,
|
||||||
|
|
|
@ -17,7 +17,7 @@ from zerver.actions.presence import do_update_user_presence
|
||||||
from zerver.actions.user_settings import do_change_user_setting
|
from zerver.actions.user_settings import do_change_user_setting
|
||||||
from zerver.actions.users import do_change_user_role
|
from zerver.actions.users import do_change_user_role
|
||||||
from zerver.lib.event_schema import check_web_reload_client_event
|
from zerver.lib.event_schema import check_web_reload_client_event
|
||||||
from zerver.lib.events import fetch_initial_state_data
|
from zerver.lib.events import fetch_initial_state_data, post_process_state
|
||||||
from zerver.lib.exceptions import AccessDeniedError
|
from zerver.lib.exceptions import AccessDeniedError
|
||||||
from zerver.lib.request import RequestVariableMissingError
|
from zerver.lib.request import RequestVariableMissingError
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
|
@ -828,6 +828,22 @@ class FetchInitialStateDataTest(ZulipTestCase):
|
||||||
[pronouns_field] = (field for field in custom_profile_fields if field["name"] == "Pronouns")
|
[pronouns_field] = (field for field in custom_profile_fields if field["name"] == "Pronouns")
|
||||||
self.assertEqual(pronouns_field["type"], CustomProfileField.PRONOUNS)
|
self.assertEqual(pronouns_field["type"], CustomProfileField.PRONOUNS)
|
||||||
|
|
||||||
|
def test_unreads_case_insensitive_topics(self) -> None:
|
||||||
|
sender = self.example_user("hamlet")
|
||||||
|
self.login_user(sender)
|
||||||
|
self.send_stream_message(sender, "Denmark", "**hello**", topic_name="case DOES not MATTER")
|
||||||
|
self.send_stream_message(sender, "Denmark", "**bye**", topic_name="CASE does NOT matter")
|
||||||
|
|
||||||
|
reader = self.example_user("othello")
|
||||||
|
result = fetch_initial_state_data(
|
||||||
|
user_profile=reader,
|
||||||
|
realm=reader.realm,
|
||||||
|
)
|
||||||
|
post_process_state(reader, result, False)
|
||||||
|
self.assert_length(result["unread_msgs"]["streams"], 1)
|
||||||
|
self.assertEqual(result["unread_msgs"]["streams"][0]["topic"], "case DOES not MATTER")
|
||||||
|
self.assert_length(result["unread_msgs"]["streams"][0]["unread_message_ids"], 2)
|
||||||
|
|
||||||
|
|
||||||
class ClientDescriptorsTest(ZulipTestCase):
|
class ClientDescriptorsTest(ZulipTestCase):
|
||||||
def test_get_client_info_for_all_public_streams(self) -> None:
|
def test_get_client_info_for_all_public_streams(self) -> None:
|
||||||
|
|
Loading…
Reference in New Issue