]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Notice.php
Encode repeats as share activities
[quix0rs-gnu-social.git] / classes / Notice.php
index 650dca051b359727ec00cc64c8f44b07cd280a3e..4ee003c48a533fd799abefcd7529f61f593942bb 100644 (file)
@@ -1473,21 +1473,32 @@ class Notice extends Memcached_DataObject
 
         if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
 
+            $act->id      = $this->uri;
+            $act->time    = strtotime($this->created);
+            $act->link    = $this->bestUrl();
+            $act->content = common_xml_safe_str($this->rendered);
+            $act->title   = common_xml_safe_str($this->content);
+
             $profile = $this->getProfile();
 
             $act->actor            = ActivityObject::fromProfile($profile);
             $act->actor->extra[]   = $profile->profileInfo($cur);
-            $act->verb             = ActivityVerb::POST;
-            $act->objects[]        = ActivityObject::fromNotice($this);
 
-            // XXX: should this be handled by default processing for object entry?
+            if ($this->repeat_of) {
 
-            $act->time    = strtotime($this->created);
-            $act->link    = $this->bestUrl();
+                $repeated = Notice::staticGet('id', $this->repeat_of);
 
-            $act->content = common_xml_safe_str($this->rendered);
-            $act->id      = $this->uri;
-            $act->title   = common_xml_safe_str($this->content);
+                $act->verb             = ActivityVerb::SHARE;
+                $act->objects[]        = $repeated->asActivity($cur);
+
+            } else {
+
+                $act->verb             = ActivityVerb::POST;
+                $act->objects[]        = ActivityObject::fromNotice($this);
+
+            }
+
+            // XXX: should this be handled by default processing for object entry?
 
             // Categories