diff --git a/zerver/actions/create_user.py b/zerver/actions/create_user.py index 02e8418b0f..cb1f004052 100644 --- a/zerver/actions/create_user.py +++ b/zerver/actions/create_user.py @@ -180,9 +180,9 @@ def add_new_user_history(user_profile: UserProfile, streams: Iterable[Stream]) - recipient_ids = [stream.recipient_id for stream in streams if not stream.invite_only] # Start by finding recent messages matching those recipients. - one_month_ago = timezone_now() - ONBOARDING_RECENT_TIMEDELTA + cutoff_date = timezone_now() - ONBOARDING_RECENT_TIMEDELTA recent_message_ids = set( - Message.objects.filter(recipient_id__in=recipient_ids, date_sent__gt=one_month_ago) + Message.objects.filter(recipient_id__in=recipient_ids, date_sent__gt=cutoff_date) .order_by("-id") .values_list("id", flat=True)[0:MAX_NUM_ONBOARDING_MESSAGES] )