Skip to content

Instantly share code, notes, and snippets.

@sebastinez
Last active November 24, 2021 08:34
Show Gist options
  • Save sebastinez/f0e91d5a5444189df18be8ae9d193f2d to your computer and use it in GitHub Desktop.
Save sebastinez/f0e91d5a5444189df18be8ae9d193f2d to your computer and use it in GitHub Desktop.
override org owner
diff --git a/src/base/orgs/Org.ts b/src/base/orgs/Org.ts
index f0ab38f..71b12f7 100644
--- a/src/base/orgs/Org.ts
+++ b/src/base/orgs/Org.ts
@@ -275,7 +275,7 @@ export class Org {
const org = await Org.get(addressOrName, config);
if (org) {
- const ownerProfile = await Profile.get(org.owner, profileType, config);
+ const ownerProfile = await Profile.get(org.owner, profileType, config, true);
if (ownerProfile.ens || ownerProfile.idx) {
return ownerProfile;
diff --git a/src/base/users/View.svelte b/src/base/users/View.svelte
index 3b1cf32..73c1f98 100644
--- a/src/base/users/View.svelte
+++ b/src/base/users/View.svelte
@@ -153,7 +153,7 @@
<div class="member-icon">
<Avatar source={profile.avatar ?? profile.address} address={profile.address} />
</div>
- <Address address={profile.address} compact
+ <Address address={profile.overriddenByOrgOwner ? org.address : profile.address} compact
resolve noBadge noAvatar {profile} {config} />
</div>
{/await}
diff --git a/src/profile.ts b/src/profile.ts
index ebc4189..4ceeb86 100644
--- a/src/profile.ts
+++ b/src/profile.ts
@@ -19,9 +19,11 @@ export enum ProfileType {
export class Profile {
profile: IProfile;
+ overriddenByOrgOwner: boolean;
- constructor(profile: IProfile) {
+ constructor(profile: IProfile, overriddenByOrgOwner = false) {
this.profile = profile;
+ this.overriddenByOrgOwner = overriddenByOrgOwner;
}
// Get the Ethereum address
@@ -171,8 +173,9 @@ export class Profile {
addressOrName: string,
profileType: ProfileType,
config: Config,
+ overridden?: boolean,
): Promise<Profile> {
const profile = await this.lookupProfile(addressOrName, profileType, config);
- return new Profile(profile);
+ return new Profile(profile, overridden);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment