Skip to content

Commit

Permalink
Register the AirdropBot user
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan committed Jul 26, 2024
1 parent 977e6fd commit cc110ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

### Changed

- Register the AirdropBot user ([#6129](https://github.com/open-chat-labs/open-chat/pull/6129))

## [[2.0.1258](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1258-user_index)] - 2024-07-26

### Added
Expand Down
15 changes: 14 additions & 1 deletion backend/canisters/user_index/impl/src/lifecycle/post_upgrade.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::Data;
use crate::{mutate_state, Data};
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
use stable_memory::get_reader;
use tracing::info;
use types::UserType;
use user_index_canister::post_upgrade::Args;
use utils::cycles::init_cycles_dispenser_client;

Expand All @@ -23,5 +24,17 @@ fn post_upgrade(args: Args) {
init_cycles_dispenser_client(data.cycles_dispenser_canister_id, data.test_mode);
init_state(env, data, args.wasm_version);

mutate_state(|state| {
// Register the AirdropBot
state.data.users.register(
state.data.airdrop_bot_canister_id,
state.data.airdrop_bot_canister_id.into(),
"AirdropBot".to_string(),
0,
None,
UserType::OcControlledBot,
);
});

info!(version = %args.wasm_version, "Post-upgrade complete");
}

0 comments on commit cc110ec

Please sign in to comment.