Skip to content

Commit

Permalink
#1731 Fix type in update
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Jan 27, 2021
1 parent d58d3e7 commit cee616f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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() (
tagsToRemove <- (alert.tags.toSet -- tags).toTry(tagSrv.getOrCreate)
_ <- tagsToAdd.toTry(alertTagSrv.create(AlertTag(), alert, _))
_ = if (tags.nonEmpty) get(alert).outE[AlertTag].filter(_.otherV.hasId(tagsToRemove.map(_._id): _*)).remove()
_ <- get(alert).update(_.tags, tags).getOrFail("Alert")
_ <- get(alert).update(_.tags, tags.toSeq).getOrFail("Alert")
_ <- auditSrv.alert.update(alert, Json.obj("tags" -> tags))
} yield (tagsToAdd, tagsToRemove)

Expand Down
6 changes: 3 additions & 3 deletions thehive/app/org/thp/thehive/services/CaseSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class CaseSrv @Inject() (
`case`: Case with Entity,
impactStatus: ImpactStatus with Entity
)(implicit graph: Graph, authContext: AuthContext): Try[Unit] = {
get(`case`).update(_.impactStatus, impactStatus).outE[CaseImpactStatus].remove()
get(`case`).update(_.impactStatus, Some(impactStatus.value)).outE[CaseImpactStatus].remove()
caseImpactStatusSrv.create(CaseImpactStatus(), `case`, impactStatus)
auditSrv.`case`.update(`case`, Json.obj("impactStatus" -> impactStatus.value))
}
Expand All @@ -283,7 +283,7 @@ class CaseSrv @Inject() (
`case`: Case with Entity,
resolutionStatus: ResolutionStatus with Entity
)(implicit graph: Graph, authContext: AuthContext): Try[Unit] = {
get(`case`).update(_.resolutionStatus, resolutionStatus).outE[CaseResolutionStatus].remove()
get(`case`).update(_.resolutionStatus, Some(resolutionStatus.value)).outE[CaseResolutionStatus].remove()
caseResolutionStatusSrv.create(CaseResolutionStatus(), `case`, resolutionStatus)
auditSrv.`case`.update(`case`, Json.obj("resolutionStatus" -> resolutionStatus.value))
}
Expand All @@ -294,7 +294,7 @@ class CaseSrv @Inject() (
}

def assign(`case`: Case with Entity, user: User with Entity)(implicit graph: Graph, authContext: AuthContext): Try[Unit] = {
get(`case`).update(_.assignee, user.login).outE[CaseUser].remove()
get(`case`).update(_.assignee, Some(user.login)).outE[CaseUser].remove()
caseUserSrv.create(CaseUser(), `case`, user)
auditSrv.`case`.update(`case`, Json.obj("owner" -> user.login))
}
Expand Down

0 comments on commit cee616f

Please sign in to comment.