Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
add_new_user_history: Remove the RECENT_MESSAGES_TIMEDELTA limit.
Prakhar Pratyushded6bfd3f2af
diff --git a/zerver/actions/create_user.py b/zerver/actions/create_user.pyindex 297622dccfb..7711451b691 100644--- a/zerver/actions/create_user.py+++ b/zerver/actions/create_user.py@@ -1,7 +1,6 @@from collections import defaultdictfrom collections.abc import Iterable, Sequencefrom contextlib import suppress-from datetime import timedeltafrom typing import Anyfrom django.conf import settings@@ -71,12 +70,6 @@ from zerver.tornado.django_api import send_event_on_commitMAX_NUM_RECENT_MESSAGES = 1000MAX_NUM_RECENT_UNREAD_MESSAGES = 20-# We don't want to mark years-old messages as unread, since that might-# feel like Zulip is buggy, but in low-traffic or bursty-traffic-# organizations, it's reasonable for the most recent 20 messages to be-# several weeks old and still be a good place to start.-RECENT_MESSAGES_TIMEDELTA = timedelta(weeks=12)-def send_message_to_signup_notification_stream(sender: UserProfile, realm: Realm, message: str@@ -201,13 +194,11 @@ def add_new_user_history(]# Start by finding recent messages matching those recipients.- cutoff_date = timezone_now() - RECENT_MESSAGES_TIMEDELTArecent_message_ids = set(Message.objects.filter(# Uses index: zerver_message_realm_recipient_idrealm_id=realm.id,recipient_id__in=recipient_ids,- date_sent__gt=cutoff_date,).order_by("-id").values_list("id", flat=True)[0:MAX_NUM_RECENT_MESSAGES]diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex 8ab0bfd07b4..8aeecf470b8 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -1025,24 +1025,11 @@ class LoginTest(ZulipTestCase):reset_email_visibility_to_everyone_in_zulip_realm()realm = get_realm("zulip")- hamlet = self.example_user("hamlet")stream_names = [f"stream_{i}" for i in range(40)]for stream_name in stream_names:stream = self.make_stream(stream_name, realm=realm)DefaultStream.objects.create(stream=stream, realm=realm)- # Make sure there's at least one recent message to be mark- # unread. This prevents a bug where this test would start- # failing the test database was generated more than- # RECENT_MESSAGES_TIMEDELTA ago.- self.subscribe(hamlet, "stream_0")- self.send_stream_message(- hamlet,- "stream_0",- topic_name="test topic",- content="test message",- )-# Clear the ContentType cache.ContentType.objects.clear_cache()