Skip to content

Commit

Permalink
Fix: deployments show with personal orgs (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauorriols authored Feb 29, 2024
1 parent 804d050 commit 0cb1040
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/subcommands/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ async function showDeployment(args: Args): Promise<void> {
);
return Deno.exit(1);
}
const organization = project.organization;
let organization = project.organization;
if (!organization.name && !organization.members) {
// project.organization does not incude members array, and we need it for naming personal orgs
organization = await api.getOrganizationById(organization.id);
}
spinner.succeed(
`The details of the deployment '${build.deploymentId}' are ready:`,
);
Expand Down
3 changes: 1 addition & 2 deletions src/subcommands/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ async function showProject(args: Args): Promise<void> {
? magenta(project.organization.name)
: `${
magenta(
// If project exists, organization must also exist
(await api.getOrganizationById(project.organization.id))!.members[0]
(await api.getOrganizationById(project.organization.id)).members[0]
.user
.name,
)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class API {
}
}

async getOrganizationById(id: string): Promise<Organization | undefined> {
async getOrganizationById(id: string): Promise<Organization> {
return await this.#requestJson(`/organizations/${id}`);
}

Expand Down

0 comments on commit 0cb1040

Please sign in to comment.