Skip to content

Commit

Permalink
Fixes #1638
Browse files Browse the repository at this point in the history
(cherry picked from commit d7e4a51)
  • Loading branch information
oharsta authored and baszoetekouw committed Oct 16, 2024
1 parent 41fd7ea commit f412fc6
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions client/src/components/redesign/ServiceOrganisations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class ServiceOrganisations extends React.Component {

doDisallow = (organisation, showConfirmation = true, accessToNone = false) => {
const {service} = this.props;
const {collAffected, orgAffected} = this.getAffectedEntities(organisation, service);
if (showConfirmation && (collAffected.length > 0 || orgAffected.length > 0)) {
const collAffected = this.getAffectedEntities(organisation, service);
if (showConfirmation && collAffected.length > 0) {
this.setState({
confirmationDialogOpen: true,
confirmationDialogAction: () => {
Expand All @@ -138,7 +138,7 @@ class ServiceOrganisations extends React.Component {
}

renderConfirmation = (service, disallowedOrganisation) => {
const {collAffected, orgAffected} = this.getAffectedEntities(disallowedOrganisation, service);
const collAffected= this.getAffectedEntities(disallowedOrganisation, service);
const collAffectedUnique = removeDuplicates(collAffected, "id");
return (
<div className="allowed-organisations-confirmation">
Expand All @@ -148,10 +148,6 @@ class ServiceOrganisations extends React.Component {
<span>{` - ${I18n.t("models.serviceOrganisations.collaboration")}`}</span>
</li>)
}
{orgAffected.map(org => <li key={org.id}>{org.name}
<span>{`- ${I18n.t("models.serviceOrganisations.organisation")}`}</span>
</li>)
}
</ul>
</div>
);
Expand All @@ -167,9 +163,7 @@ class ServiceOrganisations extends React.Component {
getAffectedEntities = (organisations, service) => {
organisations = Array.isArray(organisations) ? organisations : [organisations];
const organisationIdentifiers = organisations.map(org => org.id);
const collAffected = service.collaborations.filter(coll => organisationIdentifiers.includes(coll.organisation_id));
const orgAffected = service.organisations.filter(org => organisationIdentifiers.includes(org.id));
return {collAffected, orgAffected};
return service.collaborations.filter(coll => organisationIdentifiers.includes(coll.organisation_id));
}

setConnectionAccessValue = value => {
Expand Down Expand Up @@ -226,8 +220,8 @@ class ServiceOrganisations extends React.Component {
}
case NONE_INSTITUTIONS: {
const organisations = (service.automatic_connection_allowed_organisations || []).concat(service.allowed_organisations || []);
const {collAffected, orgAffected} = this.getAffectedEntities(organisations, service);
if (collAffected.length > 0 || orgAffected.length > 0) {
const collAffected = this.getAffectedEntities(organisations, service);
if (collAffected.length > 0) {
this.setState({
confirmationDialogOpen: true,
confirmationDialogAction: () => {
Expand Down

0 comments on commit f412fc6

Please sign in to comment.