Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DiamondMembershipExpiryDate event which is no longer needed #5245

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/canisters/local_user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Simplify timer jobs + make them more efficient ([#5233](https://github.com/open-chat-labs/open-chat/pull/5233))
- Avoid setting up canister timer unless job already in progress ([#5243](https://github.com/open-chat-labs/open-chat/pull/5243))

### Removed

- Remove `DiamondMembershipExpiryDate` event which is no longer needed ([#5245](https://github.com/open-chat-labs/open-chat/pull/5245))

## [[2.0.1011](https://github.com/open-chat-labs/open-chat/releases/tag/v2.0.1011-local_user_index)] - 2024-01-18

### Added
Expand Down
1 change: 0 additions & 1 deletion backend/canisters/local_user_index/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub enum Event {
DiamondMembershipPaymentReceived(DiamondMembershipPaymentReceived),
OpenChatBotMessage(Box<OpenChatBotMessage>),
ReferralCodeAdded(ReferralCodeAdded),
DiamondMembershipExpiryDate(UserId, TimestampMillis), // Temp event type to populate expiry dates
}

#[derive(Serialize, Deserialize, Clone, Debug)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,5 @@ fn handle_event(event: Event, state: &mut RuntimeState) {
.referral_codes
.add(ev.referral_type, ev.code, ev.expiry, state.env.now());
}
Event::DiamondMembershipExpiryDate(user_id, expires_at) => {
state
.data
.global_users
.set_diamond_membership_expiry_date(user_id, expires_at);
}
}
}
4 changes: 4 additions & 0 deletions backend/canisters/user_index/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Simplify timer jobs + make them more efficient ([#5233](https://github.com/open-chat-labs/open-chat/pull/5233))
- Avoid setting up canister timer unless job already in progress ([#5243](https://github.com/open-chat-labs/open-chat/pull/5243))

### Removed

- Remove `DiamondMembershipExpiryDate` event which is no longer needed ([#5245](https://github.com/open-chat-labs/open-chat/pull/5245))

### Fixed

- Notify community canisters when a user is unsuspended ([#5227](https://github.com/open-chat-labs/open-chat/pull/5227))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
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_macros::post_upgrade;
use local_user_index_canister::Event;
use stable_memory::get_reader;
use tracing::info;
use user_index_canister::post_upgrade::Args;
Expand All @@ -24,22 +23,5 @@ 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| {
let now = state.env.now();
for user in state.data.users.iter() {
if let Some(expires_at) = user.diamond_membership_details.expires_at() {
if expires_at > now {
for local_user_index_canister_id in state.data.local_index_map.canisters() {
state.data.user_index_event_sync_queue.push(
*local_user_index_canister_id,
Event::DiamondMembershipExpiryDate(user.user_id, expires_at),
);
}
}
}
}
crate::jobs::sync_events_to_local_user_index_canisters::start_job_if_required(state);
});

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