Skip to content

Commit 0cb1040

Browse files
authored
Fix: deployments show with personal orgs (#288)
1 parent 804d050 commit 0cb1040

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/subcommands/deployments.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,11 @@ async function showDeployment(args: Args): Promise<void> {
271271
);
272272
return Deno.exit(1);
273273
}
274-
const organization = project.organization;
274+
let organization = project.organization;
275+
if (!organization.name && !organization.members) {
276+
// project.organization does not incude members array, and we need it for naming personal orgs
277+
organization = await api.getOrganizationById(organization.id);
278+
}
275279
spinner.succeed(
276280
`The details of the deployment '${build.deploymentId}' are ready:`,
277281
);

src/subcommands/projects.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ async function showProject(args: Args): Promise<void> {
122122
? magenta(project.organization.name)
123123
: `${
124124
magenta(
125-
// If project exists, organization must also exist
126-
(await api.getOrganizationById(project.organization.id))!.members[0]
125+
(await api.getOrganizationById(project.organization.id)).members[0]
127126
.user
128127
.name,
129128
)

src/utils/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export class API {
186186
}
187187
}
188188

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

0 commit comments

Comments
 (0)