don't calculate replies for remote notices
This commit is contained in:
parent
a9599d53c5
commit
891e002883
@ -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
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ class DistribQueueHandler
|
||||
}
|
||||
|
||||
try {
|
||||
$recipients = $notice->saveReplies();
|
||||
$recipients = $notice->getReplies();
|
||||
} catch (Exception $e) {
|
||||
$this->logit($notice, $e);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user