Skip to content

Commit

Permalink
feat(organizations): display org name for project owner in sharing fo…
Browse files Browse the repository at this point in the history
…rm TASK-1383 (#5382)

### 📣 Summary
When a project is owned by an organization, the sharing form will
display the name of that organization instead of the user name of the
organization owner.

### 👀 Preview steps
1. Create an MMO and a project owned by that MMO
2. Share project with one user who is a member of the MMO and another
user outside of the MMO
3. Log in as other user and open sharing form
4. Notice that the MMO name is displayed, rather than the owner's name,
on the owner row
5. Notice that the non-owner MMO member's username is displayed, rather
than the org name
  • Loading branch information
jamesrkiger authored Dec 20, 2024
1 parent 9704185 commit e347ef4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion jsapp/js/components/permissions/sharingForm.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ export default class SharingForm extends React.Component<
}
}

getOwnerOrOrgLabel(name: string, isOwner: boolean) {
if (isOwner) {
return this.state.asset ? this.state.asset.owner_label : name;
}
return name;
}

/** Check if the recipient of the transfer is the specified user */
isPendingOwner(username: string) {
return this.state.asset?.project_ownership?.status ===
Expand Down Expand Up @@ -261,7 +268,7 @@ export default class SharingForm extends React.Component<
permissions={perm.permissions}
isUserOwner={perm.user.isOwner}
isPendingOwner={this.isPendingOwner(perm.user.name)}
username={perm.user.name}
username={this.getOwnerOrOrgLabel(perm.user.name, perm.user.isOwner)}
/>
);
})}
Expand Down

0 comments on commit e347ef4

Please sign in to comment.