From 1ac55737b4b59ca26db5d9f202c509aa2567fe4e Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 19 Feb 2015 16:07:18 +0200 Subject: [PATCH] optimization --- application/Espo/Hooks/Common/Stream.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/application/Espo/Hooks/Common/Stream.php b/application/Espo/Hooks/Common/Stream.php index bdce884cb7..3648beb535 100644 --- a/application/Espo/Hooks/Common/Stream.php +++ b/application/Espo/Hooks/Common/Stream.php @@ -131,7 +131,7 @@ class Stream extends \Espo\Core\Hooks\Base } } - protected function getAutofollowUserIdList(Entity $entity) + protected function getAutofollowUserIdList(Entity $entity, array $ignoreList = array()) { $entityType = $entity->getEntityName(); @@ -147,6 +147,9 @@ class Stream extends \Espo\Core\Hooks\Base $rows = $sth->fetchAll(); foreach ($rows as $row) { $userId = $row['userId']; + if (in_array($userId, $ignoreList)) { + continue; + } $user = $this->getEntityManager()->getEntity('User', $userId); if (!$user) { continue; @@ -179,7 +182,7 @@ class Stream extends \Espo\Core\Hooks\Base $userIdList[] = $assignedUserId; } - $autofollowUserIdList = $this->getAutofollowUserIdList($entity); + $autofollowUserIdList = $this->getAutofollowUserIdList($entity, $userIdList); foreach ($autofollowUserIdList as $userId) { if (!in_array($userId, $userIdList)) { $userIdList[] = $userId;