don't calculate replies for remote notices

This commit is contained in:
Evan Prodromou 2010-02-21 23:56:48 -05:00
parent a9599d53c5
commit 891e002883
3 changed files with 31 additions and 3 deletions

View File

@ -333,8 +333,15 @@ class Notice extends Memcached_DataObject
# 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;
@ -817,6 +824,26 @@ class Notice extends Memcached_DataObject
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
*/

View File

@ -75,7 +75,7 @@ class DistribQueueHandler
}
try {
$recipients = $notice->saveReplies();
$recipients = $notice->getReplies();
} catch (Exception $e) {
$this->logit($notice, $e);
}

View File

@ -182,7 +182,8 @@ class SalmonAction extends Action
$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;