/** * Adds this notice to the inboxes of each local user who should receive * it, based on author subscriptions, group memberships, and @-replies. * * Warning: running a second time currently will make items appear * multiple times in users' inboxes. * * @fixme make more robust against errors * @fixme break up massive deliveries to smaller background tasks * * @param array $groups optional list of Group objects; * if left empty, will be loaded from group_inbox records * @param array $recipient optional list of reply profile ids * if left empty, will be loaded from reply records */ function addToInboxes($groups = null, $recipients = null) { $ni = $this->whoGets($groups, $recipients); $ids = array_keys($ni); // We remove the author (if they're a local user), // since we'll have already done this in distribute() $i = array_search($this->profile_id, $ids); if ($i !== false) { unset($ids[$i]); } // Bulk insert Inbox::bulkInsert($this->id, $ids); return; }