def do_resend_user_invite_email(prereg_user: PreregistrationUser) -> int:
    assert (prereg_user.referred_by is not None)
    assert (prereg_user.realm is not None)
    check_invite_limit(prereg_user.referred_by.realm, 1)
    prereg_user.invited_at = timezone_now()
    prereg_user.save()
    do_increment_logging_stat(prereg_user.realm, COUNT_STATS['invites_sent::day'], None, prereg_user.invited_at)
    clear_scheduled_invitation_emails(prereg_user.email)
    event = {'prereg_id': prereg_user.id, 'referrer_id': prereg_user.referred_by.id, 'email_body': None}
    queue_json_publish('invites', event)
    return datetime_to_timestamp(prereg_user.invited_at)
def do_resend_user_invite_email(prereg_user: PreregistrationUser) -> int:
    assert (prereg_user.referred_by is not None)
    assert (prereg_user.realm is not None)
    check_invite_limit(prereg_user.referred_by.realm, 1)
    prereg_user.invited_at = timezone_now()
    prereg_user.save()
    do_increment_logging_stat(prereg_user.realm, COUNT_STATS['invites_sent::day'], None, prereg_user.invited_at)
    clear_scheduled_invitation_emails(prereg_user.email)
    event = {'prereg_id': prereg_user.id, 'referrer_id': prereg_user.referred_by.id, 'email_body': None}
    queue_json_publish('invites', event)
    return datetime_to_timestamp(prereg_user.invited_at)