Skip to content

Commit

Permalink
#2369 Fix edition of tags
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 5, 2022
1 parent 4dff807 commit e14f3ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/services/AlertSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/services/CaseTemplateSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion thehive/app/org/thp/thehive/services/ObservableSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit e14f3ef

Please sign in to comment.