Activity Streams JSON: inReplyTo objects weren't being output. Fixed.

This commit is contained in:
Zach Copley 2011-02-18 18:52:49 -08:00
parent b741184d9b
commit 93e3d49044
1 changed files with 16 additions and 5 deletions

View File

@ -142,7 +142,7 @@ class ActivityContext
{ {
$context = array(); $context = array();
$context['replyTo'] = $this->getInReplyToArray(); $context['inReplyTo'] = $this->getInReplyToArray();
$context['conversation'] = $this->conversation; $context['conversation'] = $this->conversation;
$context['forwardId'] = $this->forwardID; $context['forwardId'] = $this->forwardID;
$context['forwardUrl'] = $this->forwardUrl; $context['forwardUrl'] = $this->forwardUrl;
@ -178,20 +178,31 @@ class ActivityContext
return $tos; 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() function getInReplyToArray()
{ {
if (empty($this->replyToID) && empty($this->replyToUrl)) {
return null;
}
$replyToObj = array('objectType' => 'note'); $replyToObj = array('objectType' => 'note');
$replyToObj['id'] = $this->replyToID; // 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)) { if (!empty($this->replyToUrl)) {
$replyToObj['url'] = $this->replyToUrl; $replyToObj['url'] = $this->replyToUrl;
} }
return $replyToObj;
} }
} }