From 93e3d49044029856d4c9ce3710385dc5154084a1 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 18 Feb 2011 18:52:49 -0800 Subject: [PATCH] Activity Streams JSON: inReplyTo objects weren't being output. Fixed. --- lib/activitycontext.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/activitycontext.php b/lib/activitycontext.php index acbd0e599f..2eff3fb15f 100644 --- a/lib/activitycontext.php +++ b/lib/activitycontext.php @@ -142,7 +142,7 @@ class ActivityContext { $context = array(); - $context['replyTo'] = $this->getInReplyToArray(); + $context['inReplyTo'] = $this->getInReplyToArray(); $context['conversation'] = $this->conversation; $context['forwardId'] = $this->forwardID; $context['forwardUrl'] = $this->forwardUrl; @@ -178,20 +178,31 @@ class ActivityContext return $tos; } - /* - * Show replyTo + /** + * Return an array for the notices this notice is a reply to + * suitable for serializing as JSON note objects. + * + * @return array the array of notes */ function getInReplyToArray() { - $replyToObj = array('objectType' => 'note'); + if (empty($this->replyToID) && empty($this->replyToUrl)) { + return null; + } - $replyToObj['id'] = $this->replyToID; + $replyToObj = array('objectType' => 'note'); + // XXX: Possibly shorten this to just the numeric ID? + // Currently, it's the full URI of the notice. + if (!empty($this->replyToID)) { + $replyToObj['id'] = $this->replyToID; + } if (!empty($this->replyToUrl)) { $replyToObj['url'] = $this->replyToUrl; } + return $replyToObj; } } -- 2.39.5