Skip to content

Commit

Permalink
deposit-ui: fix affiliations rendering during edits
Browse files Browse the repository at this point in the history
  • Loading branch information
slint committed Nov 24, 2024
1 parent e20bd90 commit 0080ab0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const creatibutorNameDisplay = (value) => {

const familyName = _get(value, "person_or_org.family_name", "");
const givenName = _get(value, "person_or_org.given_name", "");
const affiliations = _map(value?.affiliations, "name");
const affiliations = value?.affiliations.map(
(affiliation) => affiliation.text || affiliation.name
);
const name = _get(value, `person_or_org.name`);

const affiliation = affiliations.length ? ` (${affiliations.join(", ")})` : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,10 @@ export class CreatibutorsModal extends Component {
}
};

serializeAffiliations = (creatibutors) => {
serializeSuggestions = (creatibutors) => {
const { isOrganization } = this.state;

// TODO: AffiliationsSuggestions is wrongly named, since it also serializes authors,
// this has to be fixed upstream though
return AffiliationsSuggestions(creatibutors, isOrganization);
};

Expand Down Expand Up @@ -482,7 +483,7 @@ export class CreatibutorsModal extends Component {
// Disable UI-side filtering of search results
search={(options) => options}
suggestionAPIUrl="/api/names"
serializeSuggestions={this.serializeAffiliations}
serializeSuggestions={this.serializeSuggestions}
onValueChange={this.onPersonSearchChange}
ref={this.namesAutocompleteRef}
/>
Expand Down Expand Up @@ -544,7 +545,7 @@ export class CreatibutorsModal extends Component {
// Disable UI-side filtering of search results
search={(options) => options}
suggestionAPIUrl="/api/affiliations"
serializeSuggestions={this.serializeAffiliations}
serializeSuggestions={this.serializeSuggestions}
onValueChange={this.onOrganizationSearchChange}
/>
)}
Expand Down

0 comments on commit 0080ab0

Please sign in to comment.