Skip to content

Commit b68e6a2

Browse files
authored
feat(ic-admin): Show the proposal URL for --dry-run (dfinity#3596)
- Extend `print_proposal` to include URL information in its output. - Adjust related code to align with signature change.
1 parent ae91325 commit b68e6a2

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

rs/registry/admin-derive/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn impl_proposal_metadata(ast: &syn::DeriveInput) -> TokenStream {
2323
}
2424

2525
fn url(&self) -> String {
26-
parse_proposal_url(self.proposal_url.clone())
26+
parse_proposal_url(&self.proposal_url)
2727
}
2828

2929
fn proposer_and_sender(&self, sender: Sender) -> (NeuronId, Sender) {

rs/registry/admin/src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(crate) fn summary_from_string_or_file(
6262
}
6363

6464
/// Parses the URL of a proposal.
65-
pub(crate) fn parse_proposal_url(url: Option<Url>) -> String {
65+
pub(crate) fn parse_proposal_url(url: &Option<Url>) -> String {
6666
match url {
6767
Some(url) => {
6868
if url.scheme() != "https" {

rs/registry/admin/src/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3246,7 +3246,7 @@ async fn propose_to_create_service_nervous_system(
32463246
));
32473247
let title = cmd.title();
32483248
let summary = cmd.summary.clone().unwrap();
3249-
let url = parse_proposal_url(cmd.proposal_url.clone());
3249+
let url = parse_proposal_url(&cmd.proposal_url);
32503250
let proposal = MakeProposalRequest {
32513251
title: Some(title.clone()),
32523252
summary,
@@ -5767,7 +5767,7 @@ async fn propose_to_add_or_remove_node_provider(
57675767
let response = canister_client
57685768
.submit_add_or_remove_node_provider_proposal(
57695769
payload,
5770-
parse_proposal_url(cmd.proposal_url),
5770+
parse_proposal_url(&cmd.proposal_url),
57715771
title,
57725772
summary,
57735773
)
@@ -6354,19 +6354,22 @@ fn print_proposal<T: Serialize + Debug, Command: ProposalMetadata + ProposalTitl
63546354
struct Proposal<T> {
63556355
title: String,
63566356
summary: String,
6357+
url: String,
63576358
payload: T,
63586359
}
63596360

63606361
let serialized = serde_json::to_string_pretty(&Proposal {
63616362
title: cmd.title(),
63626363
summary: cmd.summary(),
6364+
url: cmd.url(),
63636365
payload,
63646366
})
63656367
.expect("Serialization for the cmd to JSON failed.");
63666368
println!("{}", serialized);
63676369
} else {
63686370
println!("Title: {}\n", cmd.title());
63696371
println!("Summary: {}\n", cmd.summary());
6372+
println!("URL: {}\n", cmd.url());
63706373
println!("Payload: {:#?}", payload);
63716374
}
63726375
}

0 commit comments

Comments
 (0)