[Favorite] Properly trigger DisfavorNotice on profile deletion

This commit is contained in:
Alexei Sorokin 2020-07-24 12:45:30 +03:00 committed by Diogo Peralta Cordeiro
parent 182f94cf6f
commit a719684c6c
1 changed files with 10 additions and 6 deletions

View File

@ -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) {