Skip to content

Commit

Permalink
Fix display name computation in team member list
Browse files Browse the repository at this point in the history
When adding a new member to a team, the team member list is rendered
several times before settling. The user attributes are missing on the
first render, so take that into account in the display name
computation.
  • Loading branch information
simenheg committed Nov 7, 2023
1 parent 3ab226e commit a3ddc67
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/RoleMembers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="role-group__members-list">
<span v-for="member in membersWithRole" :key="member.id" class="role-group__member">
<pkt-button size="small" skin="tertiary" @onClick="openProfileModal(member.id)">
{{ member.displayName || firstPartOfEmail(member.id) }}
{{ displayName(member) }}
</pkt-button>
</span>
</div>
Expand Down Expand Up @@ -33,8 +33,8 @@ export default {
},
methods: {
firstPartOfEmail(email) {
return email.replace(/@.*/, '');
displayName(member) {
return member.displayName || member.id?.replace(/@.*/, '') || '';
},
openProfileModal(profileId) {
Expand Down

0 comments on commit a3ddc67

Please sign in to comment.