# Clear the cache for subscribed users, so they'll update at next request
# XXX: someone clever could prepend instead of clearing the cache
+
$notice->blowOnInsert();
+ if (isset($replies)) {
+ $notice->saveKnownReplies($replies);
+ } else {
+ $notice->saveReplies();
+ }
+
$notice->distribute();
return $notice;
return true;
}
+ function saveKnownReplies($uris)
+ {
+ foreach ($uris as $uri) {
+
+ $user = User::staticGet('uri', $uri);
+
+ if (!empty($user)) {
+
+ $reply = new Reply();
+
+ $reply->notice_id = $this->id;
+ $reply->profile_id = $user->id;
+
+ $id = $reply->insert();
+ }
+ }
+
+ return;
+ }
+
/**
* @return array of integer profile IDs
*/
}
try {
- $recipients = $notice->saveReplies();
+ $recipients = $notice->getReplies();
} catch (Exception $e) {
$this->logit($notice, $e);
}
return true;
}
-
+
protected function logit($notice, $e)
{
common_log(LOG_ERR, "Distrib queue exception saving notice $notice->id: " .
$options = array('is_local' => Notice::REMOTE_OMB,
'uri' => $this->act->object->id,
'url' => $this->act->object->link,
- 'rendered' => $rendered);
+ 'rendered' => $rendered,
+ 'replies' => $this->act->context->attention);
if (!empty($this->act->context->location)) {
$options['lat'] = $location->lat;