Skip to content

Commit

Permalink
Merge pull request #619 from akashgp09/search-relationships
Browse files Browse the repository at this point in the history
BB-454: Should not be able to create relationship with itself
  • Loading branch information
MonkeyDo committed May 21, 2021
2 parents 817546b + 6994e47 commit c6a8f0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ class EntitySearchFieldOption extends React.Component {
q: manipulatedQuery,
type: this.props.type
});
const options = response.body.filter(entity => entity.bbid !== this.props.bbid);
return {
options: response.body.map(this.entityToOption)
options: options.map(this.entityToOption)
};
}

Expand All @@ -121,6 +122,7 @@ class EntitySearchFieldOption extends React.Component {

EntitySearchFieldOption.displayName = 'EntitySearchFieldOption';
EntitySearchFieldOption.propTypes = {
bbid: PropTypes.string,
empty: PropTypes.bool,
error: PropTypes.bool,
label: PropTypes.string.isRequired,
Expand All @@ -132,6 +134,7 @@ EntitySearchFieldOption.propTypes = {
]).isRequired
};
EntitySearchFieldOption.defaultProps = {
bbid: null,
empty: true,
error: false,
languageOptions: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ class RelationshipModal
<FontAwesomeIcon icon={faExternalLinkAlt}/>
</Button>
);

const bbid = this.props.baseEntity?.bbid;
return (
<EntitySearchFieldOption
bbid={bbid}
buttonAfter={openButton}
cache={false}
instanceId="relationshipEntitySearchField"
Expand Down

0 comments on commit c6a8f0c

Please sign in to comment.