From c374028c9fbefb71d5e9731ac50a06cb42983065 Mon Sep 17 00:00:00 2001 From: Robin Riclet Date: Tue, 27 Oct 2020 17:36:26 +0100 Subject: [PATCH] #1556 No MatchError thanks to a Gremlin filter step --- thehive/app/org/thp/thehive/services/AuditSrv.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/thehive/app/org/thp/thehive/services/AuditSrv.scala b/thehive/app/org/thp/thehive/services/AuditSrv.scala index 449335dc7a..9892c34dce 100644 --- a/thehive/app/org/thp/thehive/services/AuditSrv.scala +++ b/thehive/app/org/thp/thehive/services/AuditSrv.scala @@ -296,6 +296,7 @@ object AuditOps { def richAudit: Traversal[RichAudit, JMap[String, Any], Converter[RichAudit, JMap[String, Any]]] = traversal + .filter(_.context) .project( _.by .by(_.`case`.entity.fold) @@ -312,6 +313,7 @@ object AuditOps { entityRenderer: Traversal.V[Audit] => Traversal[D, G, C] ): Traversal[(RichAudit, D), JMap[String, Any], Converter[(RichAudit, D), JMap[String, Any]]] = traversal + .filter(_.context) .project( _.by .by(_.`case`.entity.fold) @@ -320,10 +322,9 @@ object AuditOps { .by(entityRenderer) ) .domainMap { - case (audit, context, visibilityContext, obj, renderedObject) if context.nonEmpty || visibilityContext.nonEmpty => + case (audit, context, visibilityContext, obj, renderedObject) => val ctx = if (context.isEmpty) visibilityContext.head else context.head RichAudit(audit, ctx, visibilityContext.head, obj.headOption) -> renderedObject - // case otherwise // FIXME } // def forCase(caseId: String): Traversal.V[Audit] = traversal.filter(_.`case`.hasId(caseId))