From 1aeca3947d7c938b9d14334d74f0fecd57a4eaf5 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 18 Feb 2010 01:47:44 +0000 Subject: Fix for cross site OMB posting problem --- lib/omb.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/omb.php b/lib/omb.php index 0f38a4936..17132a594 100644 --- a/lib/omb.php +++ b/lib/omb.php @@ -29,11 +29,9 @@ require_once 'Auth/Yadis/Yadis.php'; function omb_oauth_consumer() { - static $con = null; - if (is_null($con)) { - $con = new OAuthConsumer(common_root_url(), ''); - } - return $con; + // Don't try to make this static. Leads to issues in + // multi-site setups - Z + return new OAuthConsumer(common_root_url(), ''); } function omb_oauth_server() -- cgit v1.2.3-54-g00ecf From 891e0028838e51788e917d947cc280dbd53c1792 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 21 Feb 2010 23:56:48 -0500 Subject: don't calculate replies for remote notices --- classes/Notice.php | 27 +++++++++++++++++++++++++++ lib/distribqueuehandler.php | 4 ++-- plugins/OStatus/lib/salmonaction.php | 3 ++- 3 files changed, 31 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/classes/Notice.php b/classes/Notice.php index 6f1ef81fc..a12839d72 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -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 */ diff --git a/lib/distribqueuehandler.php b/lib/distribqueuehandler.php index 4477468d0..c31b675c1 100644 --- a/lib/distribqueuehandler.php +++ b/lib/distribqueuehandler.php @@ -75,7 +75,7 @@ class DistribQueueHandler } try { - $recipients = $notice->saveReplies(); + $recipients = $notice->getReplies(); } catch (Exception $e) { $this->logit($notice, $e); } @@ -107,7 +107,7 @@ class DistribQueueHandler return true; } - + protected function logit($notice, $e) { common_log(LOG_ERR, "Distrib queue exception saving notice $notice->id: " . diff --git a/plugins/OStatus/lib/salmonaction.php b/plugins/OStatus/lib/salmonaction.php index b128cbd13..4aba20cc4 100644 --- a/plugins/OStatus/lib/salmonaction.php +++ b/plugins/OStatus/lib/salmonaction.php @@ -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; -- cgit v1.2.3-54-g00ecf