]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
wiring in magicsig
[quix0rs-gnu-social.git] / classes / Notice.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
      */