Skip to content

Commit

Permalink
Fix CLI command invite user generating a device invitation link ins…
Browse files Browse the repository at this point in the history
…tead of a user invitation link. (#9187)

Closes #9186
  • Loading branch information
FirelightFlagboy authored Dec 13, 2024
1 parent 7a803f3 commit 3e09e77
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/src/commands/invite/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn main(args: Args) -> anyhow::Result<()> {
InviteNewUserRep::Ok { token, .. } => ParsecInvitationAddr::new(
device.organization_addr.clone(),
device.organization_id().clone(),
InvitationType::Device,
InvitationType::User,
token,
)
.to_url(),
Expand Down
14 changes: 11 additions & 3 deletions cli/tests/integration/invitations/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ use crate::{
#[rstest::rstest]
#[tokio::test]
async fn invite_user(tmp_path: TmpPath) {
let (_, TestOrganization { alice, .. }, _) = bootstrap_cli_test(&tmp_path).await.unwrap();

let (addr, TestOrganization { alice, .. }, org_id) =
bootstrap_cli_test(&tmp_path).await.unwrap();

let mut addr = addr.to_url();
addr.path_segments_mut().unwrap().push(org_id.as_ref());
addr.query_pairs_mut()
.append_pair("a", "claim_user")
.append_key_only("p");
crate::assert_cmd_success!(
with_password = DEFAULT_DEVICE_PASSWORD,
"invite",
Expand All @@ -27,7 +33,9 @@ async fn invite_user(tmp_path: TmpPath) {
"--email",
"[email protected]"
)
.stdout(predicates::str::contains("Invitation URL:"));
.stdout(predicates::str::contains(format!(
"Invitation URL: {YELLOW}{addr}"
)));
}

#[rstest::rstest]
Expand Down
1 change: 1 addition & 0 deletions newsfragments/9186.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix CLI command ``invite user`` generating a device invitation link instead of a user invitation link.

0 comments on commit 3e09e77

Please sign in to comment.