From 5333a561fe4519dd6252ff5c5f81a61467c4505b Mon Sep 17 00:00:00 2001 From: Hamish Peebles Date: Wed, 1 Jan 2025 20:31:56 +0000 Subject: [PATCH] Allow bots to upload 1GB of file data (#7131) --- backend/canisters/user_index/CHANGELOG.md | 4 ++++ .../user_index/impl/src/updates/register_bot.rs | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/backend/canisters/user_index/CHANGELOG.md b/backend/canisters/user_index/CHANGELOG.md index a92514ff91..7286100693 100644 --- a/backend/canisters/user_index/CHANGELOG.md +++ b/backend/canisters/user_index/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [unreleased] +### Changed + +- Allow bots to upload 1GB of file data ([#7131](https://github.com/open-chat-labs/open-chat/pull/7131)) + ## [[2.0.1542](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1542-user_index)] - 2024-12-19 ### Changed diff --git a/backend/canisters/user_index/impl/src/updates/register_bot.rs b/backend/canisters/user_index/impl/src/updates/register_bot.rs index 99a4d68553..4f5e9cc9c8 100644 --- a/backend/canisters/user_index/impl/src/updates/register_bot.rs +++ b/backend/canisters/user_index/impl/src/updates/register_bot.rs @@ -1,13 +1,14 @@ use crate::guards::caller_is_governance_principal; use crate::model::user_map::Bot; use crate::model::{MAX_AVATAR_SIZE, MAX_COMMANDS, MAX_DESCRIPTION_LEN}; -use crate::{mutate_state, read_state, RuntimeState, USER_LIMIT}; +use crate::{mutate_state, read_state, RuntimeState, ONE_GB, USER_LIMIT}; use candid::Principal; use canister_api_macros::{proposal, update}; use canister_tracing_macros::trace; use event_store_producer::EventBuilder; use local_user_index_canister::{BotRegistered, UserIndexEvent}; use rand::RngCore; +use storage_index_canister::add_or_update_users::UserConfig; use tracing::error; use types::{UserId, UserType}; use url::Url; @@ -89,6 +90,14 @@ fn register_bot_impl(args: Args, state: &mut RuntimeState) { None, ); + state.data.storage_index_user_sync_queue.push( + state.data.storage_index_canister_id, + UserConfig { + user_id: args.principal, + byte_limit: ONE_GB, + }, + ); + state.data.event_store_client.push( EventBuilder::new("user_registered", now) .with_user(user_id.to_string(), true)