Skip to content

Commit

Permalink
settings-ui: fix organizations metadata payload
Browse files Browse the repository at this point in the history
* Fixes a bug where organizations selected from the search in the
  profile form, should also submit the `id` so that it's linked to the
  affiliation vocabulary entry.
  • Loading branch information
slint committed Nov 28, 2024
1 parent af5cd94 commit dcdb2c8
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,19 @@ class CommunityProfileForm extends Component {
[]
)}
serializeSuggestions={(organizations) => {
// Add organizations to known organizations
organizations.forEach((organization) => {
// eslint-disable-next-line no-prototype-builtins
const isKnownOrg = this.knownOrganizations.hasOwnProperty(
organization.name
);
if (!isKnownOrg) {
this.knownOrganizations = {
...this.knownOrganizations,
[organization.name]: organization.id,
};
}
});
return AffiliationsSuggestions(organizations, true);
}}
label={
Expand Down

0 comments on commit dcdb2c8

Please sign in to comment.