Better type check, better URL

This commit is contained in:
Evan Prodromou 2013-06-05 16:51:35 -04:00
parent a9b2a86004
commit 0e83c5c824

View File

@ -576,12 +576,12 @@ class ActivityObject
$object->thumbnail = $thumbnail; $object->thumbnail = $thumbnail;
} }
switch ($object->type) { switch (ActivityObject::canonicalType($object->type)) {
case ActivityObject::IMAGE: case 'image':
$object->largerImage = $file->url; $object->largerImage = $file->url;
break; break;
case ActivityObject::VIDEO: case 'video':
case ActivityObject::AUDIO: case 'audio':
$object->stream = $file->url; $object->stream = $file->url;
break; break;
} }
@ -798,8 +798,9 @@ class ActivityObject
// TODO: upstreamDuplicates // TODO: upstreamDuplicates
// url (XXX: need to put the right thing here...) if ($this->link) {
$object['url'] = $this->id; $object['url'] = $this->link;
}
/* Extensions */ /* Extensions */
// @fixme these may collide with XML extensions // @fixme these may collide with XML extensions
@ -866,14 +867,14 @@ class ActivityObject
} }
} }
switch ($object->type) { switch (ActivityObject::canonicalType($object->type)) {
case self::IMAGE: case 'image':
if (!empty($this->largerImage)) { if (!empty($this->largerImage)) {
$object['fullImage'] = array('url' => $this->largerImage); $object['fullImage'] = array('url' => $this->largerImage);
} }
break; break;
case self::AUDIO: case 'audio':
case self::VIDEO: case 'video':
if (!empty($this->stream)) { if (!empty($this->stream)) {
$object['stream'] = array('url' => $this->stream); $object['stream'] = array('url' => $this->stream);
} }