Skip to content

Commit

Permalink
Add fallback for display name (#1105)
Browse files Browse the repository at this point in the history
  • Loading branch information
joanagmaia authored Jul 12, 2023
1 parent 8f79792 commit 82bdc4b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<h6
class="text-xs leading-5 font-medium text-gray-900 hover:text-brand-500 transition"
>
{{ organization.displayName }}
{{ organization.displayName || organization.name }}
</h6>
</div>
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<p
class="text-gray-900 text-sm text-ellipsis truncate hover:text-brand-500 transition leading-relaxed"
>
{{ activeOrganization.displayName || '-' }}
{{ activeOrganization.displayName || activeOrganization.name || '-' }}
</p>
</div>
</router-link>
Expand Down Expand Up @@ -85,7 +85,7 @@
class="w-3.5"
/>
<span class="text-xs">{{
activeOrganization.displayName || '-'
activeOrganization.displayName || activeOrganization.name || '-'
}}</span>
</router-link>
</div>
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/modules/member/pages/member-form-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ function getInitialModel(r) {
attributes: r
? filteredAttributes(r.attributes)
: {},
organizations: r ? r.organizations : [],
organizations: r ? r.organizations.map((o) => ({
...o,
displayName: o.displayName || o.name,
label: o.displayName || o.name,
})) : [],
...attributes,
tags: r ? r.tags : [],
username: r ? r.username : {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<app-avatar
:entity="{
avatar: organization.logo,
displayName: organization.displayName?.replace('@', ''),
displayName: (organization.displayName || organization.name)?.replace('@', ''),
}"
size="xl"
class="mr-4"
/>
<div>
<div class="flex">
<h5>{{ organization.displayName }}</h5>
<h5>{{ organization.displayName || organization.name }}</h5>
<app-organization-badge
class="ml-2"
:organization="organization"
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/modules/organization/organization-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ i18nInit();

const fields = {
id: new IdField('id', label('id')),
name: new StringField('name', label('name'), {
required: true,
}),
displayName: new StringField('displayName', label('name'), {
required: true,
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const props = defineProps({
const { fields } = OrganizationModel;
const formSchema = new FormSchema([
fields.name,
fields.displayName,
fields.headline,
fields.description,
Expand Down Expand Up @@ -182,7 +183,8 @@ function getInitialModel(record) {
return JSON.parse(
JSON.stringify(
formSchema.initialValues({
displayName: record ? record.displayName : '',
name: record ? record.name : '',
displayName: record ? record.displayName || record.name : '',
headline: record ? record.headline : '',
description: record ? record.description : '',
joinedAt: record ? record.joinedAt : '',
Expand Down

0 comments on commit 82bdc4b

Please sign in to comment.