From 67c9c5d98611987e421f87f4701c2e3390711796 Mon Sep 17 00:00:00 2001 From: To-om Date: Tue, 5 Apr 2022 09:44:06 +0200 Subject: [PATCH] #2369 Fix edition of tags --- thehive/app/org/thp/thehive/services/AlertSrv.scala | 2 +- thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala | 2 +- thehive/app/org/thp/thehive/services/ObservableSrv.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/thehive/app/org/thp/thehive/services/AlertSrv.scala b/thehive/app/org/thp/thehive/services/AlertSrv.scala index f5d3775380..ad2e1334cb 100644 --- a/thehive/app/org/thp/thehive/services/AlertSrv.scala +++ b/thehive/app/org/thp/thehive/services/AlertSrv.scala @@ -110,7 +110,7 @@ class AlertSrv @Inject() ( tagsToAdd <- (tags -- alert.tags).toTry(tagSrv.getOrCreate) tagsToRemove = get(alert).tags.toSeq.filterNot(t => tags.contains(t.toString)) _ <- tagsToAdd.toTry(alertTagSrv.create(AlertTag(), alert, _)) - _ = if (tags.nonEmpty) get(alert).outE[AlertTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() + _ = if (tagsToRemove.nonEmpty) get(alert).outE[AlertTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() _ <- get(alert) .update(_.tags, tags.toSeq) .update(_._updatedAt, Some(new Date)) diff --git a/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala b/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala index c1b8fcf819..41b6efafc8 100644 --- a/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala +++ b/thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala @@ -97,7 +97,7 @@ class CaseTemplateSrv @Inject() ( tagsToAdd <- (tags -- caseTemplate.tags).toTry(tagSrv.getOrCreate) tagsToRemove = get(caseTemplate).tags.toSeq.filterNot(t => tags.contains(t.toString)) _ <- tagsToAdd.toTry(caseTemplateTagSrv.create(CaseTemplateTag(), caseTemplate, _)) - _ = if (tags.nonEmpty) get(caseTemplate).outE[CaseTemplateTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() + _ = if (tagsToRemove.nonEmpty) get(caseTemplate).outE[CaseTemplateTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() _ <- get(caseTemplate) .update(_.tags, tags.toSeq) .update(_._updatedAt, Some(new Date)) diff --git a/thehive/app/org/thp/thehive/services/ObservableSrv.scala b/thehive/app/org/thp/thehive/services/ObservableSrv.scala index 077bd92d34..b096dca2df 100644 --- a/thehive/app/org/thp/thehive/services/ObservableSrv.scala +++ b/thehive/app/org/thp/thehive/services/ObservableSrv.scala @@ -133,7 +133,7 @@ class ObservableSrv @Inject() ( tagsToAdd <- (tags -- observable.tags).toTry(tagSrv.getOrCreate) tagsToRemove = get(observable).tags.toSeq.filterNot(t => tags.contains(t.toString)) _ <- tagsToAdd.toTry(observableTagSrv.create(ObservableTag(), observable, _)) - _ = if (tags.nonEmpty) get(observable).outE[ObservableTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() + _ = if (tagsToRemove.nonEmpty) get(observable).outE[ObservableTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove() _ <- get(observable) .update(_.tags, tags.toSeq) .update(_._updatedAt, Some(new Date))