[COMPONENT][Notification] Do not re-render content just to grab attentions

Other minor improvements and bug fixes
This commit is contained in:
2021-12-21 16:04:50 +00:00
parent e2c0505620
commit 8b5286c383
3 changed files with 66 additions and 22 deletions

View File

@@ -144,10 +144,27 @@ abstract class Entity
}
/**
* @return array of Actors
* Who should be notified about this object?
*
* @return array of ids of Actors
*/
public function getNotificationTargets(array $ids_already_known = []): array
public function getNotificationTargetIds(array $ids_already_known = [], ?int $sender_id = null): array
{
// Additional actors that should know about this
if (array_key_exists('additional', $ids_already_known)) {
return $ids_already_known['additional'];
}
return [];
}
/**
* Who should be notified about this object?
*
* @return array of Actors
*/
public function getNotificationTargets(array $ids_already_known = [], ?int $sender_id = null): array
{
$target_ids = $this->getNotificationTargetIds($ids_already_known, $sender_id);
return $target_ids === [] ? [] : DB::findBy('actor', ['id' => $target_ids]);
}
}