Skip to content

Commit

Permalink
#1965 Fix customField selection query for alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Apr 14, 2021
1 parent 0550a08 commit 7335da9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
4 changes: 1 addition & 3 deletions thehive/app/org/thp/thehive/controllers/v0/AlertCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,7 @@ class PublicAlert @Inject() (
.property("user", UMapping.string)(_.field.updatable)
.property("customFields", UMapping.jsonNative)(_.subSelect {
case (FPathElem(_, FPathElem(idOrName, _)), alerts) =>
alerts
.customFields(EntityIdOrName(idOrName))
.jsonValue
alerts.customFieldJsonValue(customFieldSrv, EntityIdOrName(idOrName))
case (_, alerts) => alerts.customFields.nameJsonValue.fold.domainMap(JsObject(_))
}
.filter[JsValue] {
Expand Down
7 changes: 0 additions & 7 deletions thehive/app/org/thp/thehive/services/CustomFieldSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,6 @@ object CustomFieldOps {
name -> CustomFieldType.map(tpe).getJsonValue(new CustomFieldValueEdge(edge))
}

def jsonValue: Traversal[JsValue, JMap[String, Any], Converter[JsValue, JMap[String, Any]]] =
edgeNameType
.domainMap {
case (edge, _, tpe) =>
CustomFieldType.map(tpe).getJsonValue(new CustomFieldValueEdge(edge))
}

def nameValue: Traversal[(String, Option[_]), JMap[String, Any], Converter[(String, Option[_]), JMap[String, Any]]] =
edgeNameType
.domainMap {
Expand Down

0 comments on commit 7335da9

Please sign in to comment.