Skip to content

Commit

Permalink
Merge pull request #518 from bookbrainz/null-relationship-sets
Browse files Browse the repository at this point in the history
fix(BB-545): Allow relationship sets to be null (empty)
  • Loading branch information
MonkeyDo committed Oct 7, 2020
2 parents 8bc8b8e + cebe185 commit 723d746
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/server/routes/entity/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,10 +1047,11 @@ export function handleCreateOrEditEntity(

_.forEach(allEntities, (entityModel) => {
const bbid: string = entityModel.get('bbid');
if (_.has(relationshipSets, bbid) && !_.isNil(relationshipSets[bbid])) {
if (_.has(relationshipSets, bbid)) {
entityModel.set(
'relationshipSetId',
relationshipSets[bbid].get('id')
// Set to relationshipSet id or null if empty set
relationshipSets[bbid] && relationshipSets[bbid].get('id')
);
}
});
Expand Down

0 comments on commit 723d746

Please sign in to comment.