Skip to content

Commit

Permalink
#1670 Remove tag value in entity when a tag is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Mar 6, 2021
1 parent 748004f commit 0f61fb5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions thehive/app/org/thp/thehive/services/TagSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ class TagSrv @Inject() (
.when(tag.colour != input.colour)(_.update(_.colour, input.colour))
.getOrFail("Tag")
} yield updatedTag

override def delete(tag: Tag with Entity)(implicit graph: Graph): Try[Unit] = {
val tagName = tag.toString
Try {
get(tag)
.sideEffect(
_.unionFlat(_.`case`.removeValue(_.tags, tagName), _.alert.removeValue(_.tags, tagName), _.observable.removeValue(_.tags, tagName))
)
.remove()
}
}
}

object TagOps {
Expand Down

0 comments on commit 0f61fb5

Please sign in to comment.