]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
don't calculate replies for remote notices
authorEvan Prodromou <evan@status.net>
Mon, 22 Feb 2010 04:56:48 +0000 (23:56 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 22 Feb 2010 04:56:48 +0000 (23:56 -0500)
classes/Notice.php
lib/distribqueuehandler.php
plugins/OStatus/lib/salmonaction.php

index 6f1ef81fc5d3356299e028165b0b5ae6119f9e8e..a12839d729e34847d3143af4ea94d99cd4dfe8c3 100644 (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
      */
index 4477468d0a38d523c26163b3afcc987805bf3617..c31b675c1a11a48a54b21cfc1cb444dfba4033b2 100644 (file)
@@ -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: " .
index b128cbd13f6aadca2aa9d9c90ad97f9ff3b35f16..4aba20cc40d13dc42cffa40bb354332409b7ed62 100644 (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;