Skip to content

Commit

Permalink
#1648 Create link with case when merging alert
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 17, 2020
1 parent 8dfbddc commit 8116303
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions thehive/app/org/thp/thehive/services/AlertSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -276,17 +276,16 @@ class AlertSrv @Inject() (
def mergeInCase(alert: Alert with Entity, `case`: Case with Entity)(implicit graph: Graph, authContext: AuthContext): Try[Case with Entity] =
auditSrv
.mergeAudits {
// No audit for markAsRead and observables
// Audits for customFields, description and tags
val description = `case`.description + s"\n \n#### Merged with alert #${alert.sourceRef} ${alert.title}\n\n${alert.description.trim}"

for {
_ <- markAsRead(alert._id)
_ <- importObservables(alert, `case`)
_ <- importCustomFields(alert, `case`)
_ <- caseSrv.get(`case`).update(_.description, description).getOrFail("Case")
_ <- caseSrv.addTags(`case`, get(alert).tags.toSeq.map(_.toString).toSet)
// No audit for markAsRead and observables
// Audits for customFields, description and tags
c <- caseSrv.getOrFail(`case`._id)
_ <- alertCaseSrv.create(AlertCase(), alert, `case`)
c <- caseSrv.get(`case`).update(_.description, description).getOrFail("Case")
details <- Success(
Json.obj(
"customFields" -> get(alert).richCustomFields.toSeq.map(_.toOutput.toJson),
Expand Down

0 comments on commit 8116303

Please sign in to comment.