Converted all ActivityObject::fromProfile to $profile->asActivityObject

This commit is contained in:
Mikael Nordfeldth 2014-07-02 18:50:28 +02:00
parent 1d981b826a
commit b63f6e949c
12 changed files with 24 additions and 29 deletions

View File

@ -168,7 +168,7 @@ class Group_member extends Managed_DataObject
$act->id = $this->getURI();
$act->actor = ActivityObject::fromProfile($member);
$act->actor = $member->asActivityObject();
$act->verb = ActivityVerb::JOIN;
$act->objects[] = ActivityObject::fromGroup($group);

View File

@ -183,7 +183,7 @@ class Message extends Managed_DataObject
throw new Exception(sprintf("Sender profile not found: %d", $this->from_profile));
}
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->actor->extra[] = $profile->profileInfo(null);
$act->verb = ActivityVerb::POST;

View File

@ -1782,7 +1782,7 @@ class Notice extends Managed_DataObject
$profile = $this->getProfile();
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->actor->extra[] = $profile->profileInfo($cur);
$act->verb = $this->verb;

View File

@ -267,8 +267,8 @@ class Subscription extends Managed_DataObject
$subscriber->getBestName(),
$subscribed->getBestName());
$act->actor = ActivityObject::fromProfile($subscriber);
$act->objects[] = ActivityObject::fromProfile($subscribed);
$act->actor = $subscriber->asActivityObject();
$act->objects[] = $subscribed->asActivityObject();
$url = common_local_url('AtomPubShowSubscription',
array('subscriber' => $subscriber->id,

View File

@ -990,7 +990,7 @@ class User extends Managed_DataObject
$act = new Activity();
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->verb = ActivityVerb::JOIN;
$act->objects[] = $service;

View File

@ -457,11 +457,6 @@ class ActivityObject
return $object;
}
static function fromProfile(Profile $profile)
{
return $profile->asActivityObject();
}
static function fromGroup(User_group $group)
{
$object = new ActivityObject();

View File

@ -62,7 +62,7 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
$profile = $user->getProfile();
$ao = ActivityObject::fromProfile($profile);
$ao = $profile->asActivityObject();
array_push($ao->extra, $profile->profileInfo($cur));

View File

@ -390,7 +390,7 @@ class ActivityPlugin extends Plugin
if (!empty($sub)) {
$profile = Profile::getKV('id', $sub->subscribed);
if (!empty($profile)) {
$activity->objects = array(ActivityObject::fromProfile($profile));
$activity->objects = array($profile->asActivityObject());
}
}
break;

View File

@ -157,7 +157,7 @@ class Fave extends Managed_DataObject
$profile->getBestName(),
$notice->getUrl());
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->objects[] = ActivityObject::fromNotice($notice);
$url = common_local_url('AtomPubShowFavorite',

View File

@ -691,8 +691,8 @@ class OStatusPlugin extends Plugin
$profile->getBestName(),
$other->getBestName());
$act->actor = ActivityObject::fromProfile($profile);
$act->object = ActivityObject::fromProfile($other);
$act->actor = $profile->asActivityObject();
$act->object = $other->asActivityObject();
$oprofile->notifyActivity($act, $profile);
@ -728,7 +728,7 @@ class OStatusPlugin extends Plugin
$group->id,
common_date_iso8601(time()));
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->verb = ActivityVerb::JOIN;
$act->object = $oprofile->asActivityObject();
@ -782,7 +782,7 @@ class OStatusPlugin extends Plugin
$group->id,
common_date_iso8601(time()));
$act->actor = ActivityObject::fromProfile($member);
$act->actor = $member->asActivityObject();
$act->verb = ActivityVerb::LEAVE;
$act->object = $oprofile->asActivityObject();
@ -828,7 +828,7 @@ class OStatusPlugin extends Plugin
$peopletag->id,
common_date_iso8601(time()));
$act->actor = ActivityObject::fromProfile($sub);
$act->actor = $sub->asActivityObject();
$act->verb = ActivityVerb::FOLLOW;
$act->object = $oprofile->asActivityObject();
@ -880,7 +880,7 @@ class OStatusPlugin extends Plugin
$peopletag->id,
common_date_iso8601(time()));
$act->actor = ActivityObject::fromProfile($member);
$act->actor = $member->asActivityObject();
$act->verb = ActivityVerb::UNFOLLOW;
$act->object = $oprofile->asActivityObject();
@ -973,8 +973,8 @@ class OStatusPlugin extends Plugin
$tagged->getBestName(),
$plist->getBestName());
$act->actor = ActivityObject::fromProfile($tagger);
$act->objects = array(ActivityObject::fromProfile($tagged));
$act->actor = $tagger->asActivityObject();
$act->objects = array($tagged->asActivityObject());
$act->target = ActivityObject::fromPeopletag($plist);
$oprofile->notifyDeferred($act, $tagger);
@ -1024,8 +1024,8 @@ class OStatusPlugin extends Plugin
$tagged->getBestName(),
$plist->getBestName());
$act->actor = ActivityObject::fromProfile($tagger);
$act->objects = array(ActivityObject::fromProfile($tagged));
$act->actor = $tagger->asActivityObject();
$act->objects = array($tagged->asActivityObject());
$act->target = ActivityObject::fromPeopletag($plist);
$oprofile->notifyDeferred($act, $tagger);
@ -1073,7 +1073,7 @@ class OStatusPlugin extends Plugin
$profile->getBestName(),
$notice->getUrl());
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->object = ActivityObject::fromNotice($notice);
$oprofile->notifyActivity($act, $profile);
@ -1191,7 +1191,7 @@ class OStatusPlugin extends Plugin
$act->content = sprintf(_m('%s has updated their profile page.'),
$profile->getBestName());
$act->actor = ActivityObject::fromProfile($profile);
$act->actor = $profile->asActivityObject();
$act->object = $act->actor;
while ($oprofile->fetch()) {

View File

@ -132,7 +132,7 @@ class Ostatus_profile extends Managed_DataObject
} else if ($this->isPeopletag()) {
return ActivityObject::fromPeopletag($this->localPeopletag());
} else {
return ActivityObject::fromProfile($this->localProfile());
return $this->localProfile()->asActivityObject();
}
}
@ -156,7 +156,7 @@ class Ostatus_profile extends Managed_DataObject
$noun = ActivityObject::fromPeopletag($this->localPeopletag());
return $noun->asString('activity:' . $element);
} else {
$noun = ActivityObject::fromProfile($this->localProfile());
$noun = $this->localProfile()->asActivityObject();
return $noun->asString('activity:' . $element);
}
}

View File

@ -294,7 +294,7 @@ class OfflineBackupQueueHandler extends QueueHandler
$profile = $user->getProfile();
$author = ActivityObject::fromProfile($profile);
$author = $profile->asActivityObject();
$xs = new XMLStringer();
$author->outputTo($xs, 'author');