From a719684c6c00093bb99ec77cde7cbf56da0b7b58 Mon Sep 17 00:00:00 2001 From: Alexei Sorokin Date: Fri, 24 Jul 2020 12:45:30 +0300 Subject: [PATCH] [Favorite] Properly trigger DisfavorNotice on profile deletion --- modules/Favorite/classes/Fave.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/Favorite/classes/Fave.php b/modules/Favorite/classes/Fave.php index e9dd8ee616..e78b7db509 100644 --- a/modules/Favorite/classes/Fave.php +++ b/modules/Favorite/classes/Fave.php @@ -138,14 +138,18 @@ class Fave extends Managed_DataObject $result = null; try { - $profile = $this->getActor(); - $notice = $this->getTarget(); + if ($this->find()) { + while ($this->fetch()) { + $profile = $this->getActor(); + $notice = $this->getTarget(); - if (Event::handle('StartDisfavorNotice', array($profile, $notice, &$result))) { - $result = parent::delete($useWhere); + if (Event::handle('StartDisfavorNotice', [$profile, $notice, &$result])) { + $result = parent::delete($useWhere); - if ($result !== false) { - Event::handle('EndDisfavorNotice', array($profile, $notice)); + if ($result !== false) { + Event::handle('EndDisfavorNotice', [$profile, $notice]); + } + } } } } catch (NoResultException $e) {