Add avatars and notice info
This commit is contained in:
parent
b1675ff175
commit
a199192ebf
|
@ -437,10 +437,14 @@ class Activity
|
||||||
|
|
||||||
/* Purely extensions hereafter */
|
/* Purely extensions hereafter */
|
||||||
|
|
||||||
if ($this->verb == ActivityVerb::POST) {
|
// XXX: a bit of a hack... Since JSON isn't namespaced we probably
|
||||||
$activity['noticeInfo'] = $this->noticeInfo;
|
// shouldn't be using 'statusnet:notice_info', but this will work
|
||||||
}
|
// for the moment.
|
||||||
|
|
||||||
|
foreach ($this->extra as $e) {
|
||||||
|
list($objectName, $props, $txt) = $e;
|
||||||
|
$activity[$objectName] = $props;
|
||||||
|
}
|
||||||
|
|
||||||
return array_filter($activity);
|
return array_filter($activity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -663,24 +663,33 @@ class ActivityObject
|
||||||
|| $this->type == ActivityObject::GROUP) {
|
|| $this->type == ActivityObject::GROUP) {
|
||||||
|
|
||||||
// XXX: Not sure what the best avatar is to use for the
|
// XXX: Not sure what the best avatar is to use for the
|
||||||
// author's "image". For now, I'm using the stream size
|
// author's "image". For now, I'm using the large size.
|
||||||
// one, but possibly it should be large
|
|
||||||
$avatarLink = null;
|
$avatarLarge = null;
|
||||||
|
$avatarMediaLinks = array();
|
||||||
|
|
||||||
foreach ($this->avatarLinks as $a) {
|
foreach ($this->avatarLinks as $a) {
|
||||||
if ($a->height == AVATAR_STREAM_SIZE) {
|
|
||||||
$avatarLink = $a;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$imgLink = new ActivityStreamsMediaLink(
|
// Make a MediaLink for every other Avatar
|
||||||
$avatarLink->url,
|
$avatar = new ActivityStreamsMediaLink(
|
||||||
$avatarLink->width,
|
$a->url,
|
||||||
$avatarLink->height,
|
$a->width,
|
||||||
$avatarLink->type
|
$a->height,
|
||||||
|
$a->type,
|
||||||
|
'avatar'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Find the big avatar to use as the "image"
|
||||||
|
if ($a->height == AVATAR_PROFILE_SIZE) {
|
||||||
|
$imgLink = $avatar;
|
||||||
|
}
|
||||||
|
|
||||||
|
$avatarMediaLinks[] = $avatar->asArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
$object['avatars'] = $avatarMediaLinks; // extension
|
||||||
|
|
||||||
|
// image
|
||||||
$object['image'] = $imgLink->asArray();
|
$object['image'] = $imgLink->asArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,7 +707,12 @@ class ActivityObject
|
||||||
// url (XXX: need to put the right thing here...)
|
// url (XXX: need to put the right thing here...)
|
||||||
$object['url'] = $this->id;
|
$object['url'] = $this->id;
|
||||||
|
|
||||||
// TODO: extensions (OStatus stuff, etc.)
|
/* Extensions */
|
||||||
|
|
||||||
|
foreach ($this->extra as $e) {
|
||||||
|
list($objectName, $props, $txt) = $e;
|
||||||
|
$object[$objectName] = $props;
|
||||||
|
}
|
||||||
|
|
||||||
return array_filter($object);
|
return array_filter($object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ class ActivityStreamJSONDocument
|
||||||
*
|
*
|
||||||
* @param String $title the title
|
* @param String $title the title
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function setTitle($title)
|
function setTitle($title)
|
||||||
{
|
{
|
||||||
$this->doc['title'] = $title;
|
$this->doc['title'] = $title;
|
||||||
|
@ -207,7 +208,7 @@ class ActivityStreamsLink
|
||||||
$this->linkDict = array(
|
$this->linkDict = array(
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'rel' => $rel, // extension
|
'rel' => $rel, // extension
|
||||||
'mediaType' => $mediaType // extension
|
'type' => $mediaType // extension
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user