Skip to content

Commit

Permalink
Update canisters post release (#6149)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles authored Jul 30, 2024
1 parent 131f9d1 commit 1ec646d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
2 changes: 2 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1268](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1268-local_user_index)] - 2024-07-30

### Changed

- Push unique person proofs to user canisters ([#6144](https://github.com/open-chat-labs/open-chat/pull/6144))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{jobs, mutate_state, Data};
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
use local_user_index_canister::post_upgrade::Args;
use stable_memory::get_reader;
use tracing::info;
use types::CanisterId;
use user_canister::Event as UserEvent;
use utils::cycles::init_cycles_dispenser_client;

#[post_upgrade]
Expand All @@ -26,16 +24,4 @@ fn post_upgrade(args: Args) {
init_state(env, data, args.wasm_version);

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

mutate_state(|state| {
for (user_id, proof) in state.data.global_users.iter_unique_person_proofs() {
if state.data.local_users.contains(user_id) {
state.data.user_event_sync_queue.push(
CanisterId::from(*user_id),
UserEvent::NotifyUniquePersonProof(Box::new(proof.clone())),
);
}
}
jobs::sync_events_to_user_canisters::start_job_if_required(state);
});
}
2 changes: 2 additions & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [unreleased]

## [[2.0.1269](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1269-user_index)] - 2024-07-30

### Fixed

- Ensure `date_updated` is non-zero for all users ([#6146](https://github.com/open-chat-labs/open-chat/pull/6146))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::lifecycle::{init_env, init_state};
use crate::memory::get_upgrades_memory;
use crate::{mutate_state, Data};
use crate::Data;
use canister_logger::LogEntry;
use canister_tracing_macros::trace;
use ic_cdk::post_upgrade;
Expand All @@ -24,8 +24,4 @@ fn post_upgrade(args: Args) {
init_state(env, data, args.wasm_version);

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

mutate_state(|state| {
state.data.users.ensure_date_updated_non_zero(state.env.now());
});
}
8 changes: 0 additions & 8 deletions backend/canisters/user_index/impl/src/model/user_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ pub struct UserMap {
}

impl UserMap {
pub fn ensure_date_updated_non_zero(&mut self, now: TimestampMillis) {
for user in self.users.values_mut() {
if user.date_updated == 0 {
user.date_updated = now;
}
}
}

pub fn does_username_exist(&self, username: &str) -> bool {
self.username_to_user_id.contains_key(username)
}
Expand Down

0 comments on commit 1ec646d

Please sign in to comment.