Skip to content

Commit

Permalink
#1773 Use only organisation Ids to compare links
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Feb 4, 2021
1 parent 75a50e2 commit 7de8657
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thehive/app/org/thp/thehive/services/OrganisationSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,12 @@ class OrganisationSrv @Inject() (
authContext: AuthContext,
graph: Graph
): Try[Unit] = {
val toOrgIds = toOrganisations.map(_.fold(identity, getByName(_)._id.getOrFail("Organisation").get)).toSet
val (orgToAdd, orgToRemove) = get(fromOrg)
.links
._id
.toIterator
.foldLeft((toOrganisations.toSet, Set.empty[EntityId])) {
.foldLeft((toOrgIds, Set.empty[EntityId])) {
case ((toAdd, toRemove), o) if toAdd.contains(o) => (toAdd - o, toRemove)
case ((toAdd, toRemove), o) => (toAdd, toRemove + o)
}
Expand Down

0 comments on commit 7de8657

Please sign in to comment.