Reinstate profile_info in author/actor
This commit is contained in:
parent
a199192ebf
commit
29ce5dd19a
@ -1250,7 +1250,7 @@ class Notice extends Memcached_DataObject
|
|||||||
* @return Activity activity object representing this Notice.
|
* @return Activity activity object representing this Notice.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function asActivity()
|
function asActivity($cur)
|
||||||
{
|
{
|
||||||
$act = self::cacheGet(Cache::codeKey('notice:as-activity:'.$this->id));
|
$act = self::cacheGet(Cache::codeKey('notice:as-activity:'.$this->id));
|
||||||
|
|
||||||
@ -1262,9 +1262,11 @@ class Notice extends Memcached_DataObject
|
|||||||
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
|
if (Event::handle('StartNoticeAsActivity', array($this, &$act))) {
|
||||||
|
|
||||||
$profile = $this->getProfile();
|
$profile = $this->getProfile();
|
||||||
$act->actor = ActivityObject::fromProfile($profile);
|
|
||||||
$act->verb = ActivityVerb::POST;
|
$act->actor = ActivityObject::fromProfile($profile);
|
||||||
$act->objects[] = ActivityObject::fromNotice($this);
|
$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?
|
// XXX: should this be handled by default processing for object entry?
|
||||||
|
|
||||||
@ -1402,7 +1404,7 @@ class Notice extends Memcached_DataObject
|
|||||||
$author=true,
|
$author=true,
|
||||||
$cur=null)
|
$cur=null)
|
||||||
{
|
{
|
||||||
$act = $this->asActivity();
|
$act = $this->asActivity($cur);
|
||||||
$act->extra[] = $this->noticeInfo($cur);
|
$act->extra[] = $this->noticeInfo($cur);
|
||||||
return $act->asString($namespace, $author, $source);
|
return $act->asString($namespace, $author, $source);
|
||||||
}
|
}
|
||||||
|
@ -932,12 +932,12 @@ class Profile extends Memcached_DataObject
|
|||||||
*
|
*
|
||||||
* @param User $cur Current user
|
* @param User $cur Current user
|
||||||
*
|
*
|
||||||
* @return array representation of <statusnet:profile_info> element
|
* @return array representation of <statusnet:profile_info> element or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function profileInfo($cur)
|
function profileInfo($cur)
|
||||||
{
|
{
|
||||||
$profileInfoAttr = array();
|
$profileInfoAttr = array('local_id' => $this->id);
|
||||||
|
|
||||||
if ($cur != null) {
|
if ($cur != null) {
|
||||||
// Whether the current user is a subscribed to this profile
|
// Whether the current user is a subscribed to this profile
|
||||||
|
@ -443,9 +443,10 @@ class Activity
|
|||||||
|
|
||||||
foreach ($this->extra as $e) {
|
foreach ($this->extra as $e) {
|
||||||
list($objectName, $props, $txt) = $e;
|
list($objectName, $props, $txt) = $e;
|
||||||
$activity[$objectName] = $props;
|
if (!empty($objectName)) {
|
||||||
|
$activity[$objectName] = $props;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_filter($activity);
|
return array_filter($activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ class ActivityStreamJSONDocument
|
|||||||
|
|
||||||
function addItemsFromNotices($notices)
|
function addItemsFromNotices($notices)
|
||||||
{
|
{
|
||||||
common_debug("addItemsFromNotices");
|
|
||||||
if (is_array($notices)) {
|
if (is_array($notices)) {
|
||||||
foreach ($notices as $notice) {
|
foreach ($notices as $notice) {
|
||||||
$this->addItemFromNotice($notice);
|
$this->addItemFromNotice($notice);
|
||||||
@ -114,7 +113,7 @@ class ActivityStreamJSONDocument
|
|||||||
{
|
{
|
||||||
$cur = empty($this->cur) ? common_current_user() : $this->cur;
|
$cur = empty($this->cur) ? common_current_user() : $this->cur;
|
||||||
|
|
||||||
$act = $notice->asActivity();
|
$act = $notice->asActivity($cur);
|
||||||
$act->extra[] = $notice->noticeInfo($cur);
|
$act->extra[] = $notice->noticeInfo($cur);
|
||||||
|
|
||||||
array_push($this->doc['items'], $act->asArray());
|
array_push($this->doc['items'], $act->asArray());
|
||||||
|
@ -64,7 +64,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
|
|||||||
|
|
||||||
$ao = ActivityObject::fromProfile($profile);
|
$ao = ActivityObject::fromProfile($profile);
|
||||||
|
|
||||||
$ao->extra[] = $profile->profileInfo($cur);
|
array_push($ao->extra, $profile->profileInfo($cur));
|
||||||
|
|
||||||
// XXX: For users, we generate an author _AND_ an <activity:subject>
|
// XXX: For users, we generate an author _AND_ an <activity:subject>
|
||||||
// This is for backward compatibility with clients (especially
|
// This is for backward compatibility with clients (especially
|
||||||
|
Loading…
Reference in New Issue
Block a user