From 0a7bd0bffad23bdb82993f8b4165be04c52db136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sat, 7 Mar 2020 22:30:28 +0100 Subject: [PATCH] Dont show changes to users or groups on last activity on homepage. --- src/DataTables/LogDataTable.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/DataTables/LogDataTable.php b/src/DataTables/LogDataTable.php index ad519cb5..9ae2b8db 100644 --- a/src/DataTables/LogDataTable.php +++ b/src/DataTables/LogDataTable.php @@ -54,6 +54,8 @@ use App\Entity\LogSystem\CollectionElementDeleted; use App\Entity\LogSystem\ElementCreatedLogEntry; use App\Entity\LogSystem\ElementDeletedLogEntry; use App\Entity\LogSystem\ElementEditedLogEntry; +use App\Entity\UserSystem\Group; +use App\Entity\UserSystem\User; use App\Exceptions\EntityNotSupportedException; use App\Services\ElementTypeNameGenerator; use App\Services\EntityURLGenerator; @@ -223,9 +225,9 @@ class LogDataTable implements DataTableTypeInterface 'icon' => 'fas fa-fw fa-eye', 'href' => function ($value, AbstractLogEntry $context) { if ( - ($context instanceof TimeTravelInterface - && $context->hasOldDataInformations()) - || $context instanceof CollectionElementDeleted + ($context instanceof TimeTravelInterface + && $context->hasOldDataInformations()) + || $context instanceof CollectionElementDeleted ) { try { $target = $this->logRepo->getTargetElement($context); @@ -272,7 +274,13 @@ class LogDataTable implements DataTableTypeInterface $builder->where('log INSTANCE OF ' . ElementCreatedLogEntry::class) ->orWhere('log INSTANCE OF ' . ElementDeletedLogEntry::class) ->orWhere('log INSTANCE OF ' . ElementEditedLogEntry::class) - ->orWhere('log INSTANCE OF ' . CollectionElementDeleted::class); + ->orWhere('log INSTANCE OF ' . CollectionElementDeleted::class) + ->andWhere('log.target_type NOT IN (:disallowed)');; + + $builder->setParameter('disallowed', [ + AbstractLogEntry::targetTypeClassToID(User::class), + AbstractLogEntry::targetTypeClassToID(Group::class), + ]); } if (!empty($options['filter_elements'])) {