-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove configuration dependency from user index (#230)
* add configuration methods and remove calls to configuration canister; drop known_principal_ids from canisterdata * remove custom install code; recharge canister before resetting them * ignore tests which involves upgrading cansiter * send init args to indvidual canister * fix: pick version from init args in user_index canister * added tests * stop upgrading individual canister in post-upgrade of user_index
- Loading branch information
1 parent
08db52e
commit 8224058
Showing
27 changed files
with
477 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/canister/user_index/src/api/user_signup/are_signups_enabled.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::{CANISTER_DATA, data_model::CanisterData}; | ||
|
||
|
||
#[ic_cdk::query] | ||
#[candid::candid_method(query)] | ||
fn are_signups_enabled() -> bool { | ||
CANISTER_DATA.with(|canister_data_ref_cell| { | ||
let canister_data = canister_data_ref_cell.borrow(); | ||
are_signups_enabled_impl(&canister_data) | ||
}) | ||
} | ||
|
||
fn are_signups_enabled_impl(canister_data: &CanisterData) -> bool { | ||
canister_data.configuration.signups_open_on_this_subnet | ||
} | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use std::collections::HashMap; | ||
|
||
use crate::data_model::configuration::Configuration; | ||
|
||
use super::*; | ||
|
||
#[test] | ||
fn test_are_signups_enabled_impl() { | ||
let mut canister_data = CanisterData { | ||
configuration: Configuration { | ||
known_principal_ids: HashMap::default(), | ||
signups_open_on_this_subnet: true, | ||
url_to_send_canister_metrics_to: String::from("http://example.com") | ||
}, | ||
..Default::default() | ||
}; | ||
|
||
assert!(are_signups_enabled_impl(&canister_data)); | ||
|
||
canister_data.configuration.signups_open_on_this_subnet = false; | ||
assert!(!are_signups_enabled_impl(&canister_data)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod are_signups_enabled; | ||
pub mod toggle_signups_enabled; |
Oops, something went wrong.