From adec1dedf0a3847ee210a9f94f0f0632a68de3e5 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 2 Aug 2021 11:30:48 +0200 Subject: [PATCH] Fix bug in Org.getProfile Make sure we return the original profile if the user one fails. --- src/base/orgs/Org.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/base/orgs/Org.ts b/src/base/orgs/Org.ts index 1e276a59f..6cdb1dfc8 100644 --- a/src/base/orgs/Org.ts +++ b/src/base/orgs/Org.ts @@ -212,18 +212,22 @@ export class Org { } } - // Return only org profile if there is one, otherwise tries to get the profile + // Return the org profile if there is one, otherwise try to get the profile // of its owner. static async getProfile(address: string, config: Config): Promise { const profile = await Profile.get(address, config); - if (profile.ens) { + if (profile.ens) { // Orgs only use ENS for profile information. return profile; } const org = await Org.get(address, config); if (org) { - return Profile.get(org.owner, config); + const ownerProfile = await Profile.get(org.owner, config); + + if (ownerProfile.ens || ownerProfile.idx) { + return ownerProfile; + } } return profile; }