def do_reactivate_user(user_profile: UserProfile, acting_user: Optional[UserProfile]=None) -> None:
    user_profile.is_active = True
    user_profile.save(update_fields=['is_active'])
    event_time = timezone_now()
    RealmAuditLog.objects.create(realm=user_profile.realm, modified_user=user_profile, acting_user=acting_user, event_type=RealmAuditLog.USER_REACTIVATED, event_time=event_time, extra_data=ujson.dumps({RealmAuditLog.ROLE_COUNT: realm_user_count_by_role(user_profile.realm)}))
    do_increment_logging_stat(user_profile.realm, COUNT_STATS['active_users_log:is_bot:day'], user_profile.is_bot, event_time)
    if settings.BILLING_ENABLED:
        update_license_ledger_if_needed(user_profile.realm, event_time)
    notify_created_user(user_profile)
    if user_profile.is_bot:
        notify_created_bot(user_profile)
def do_reactivate_user(user_profile: UserProfile, acting_user: Optional[UserProfile]=None) -> None:
    user_profile.is_active = True
    user_profile.save(update_fields=['is_active'])
    event_time = timezone_now()
    RealmAuditLog.objects.create(realm=user_profile.realm, modified_user=user_profile, acting_user=acting_user, event_type=RealmAuditLog.USER_REACTIVATED, event_time=event_time, extra_data=ujson.dumps({RealmAuditLog.ROLE_COUNT: realm_user_count_by_role(user_profile.realm)}))
    do_increment_logging_stat(user_profile.realm, COUNT_STATS['active_users_log:is_bot:day'], user_profile.is_bot, event_time)
    if settings.BILLING_ENABLED:
        update_license_ledger_if_needed(user_profile.realm, event_time)
    notify_created_user(user_profile)
    if user_profile.is_bot:
        notify_created_bot(user_profile)