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->id = $this->getURI();
$act->actor = ActivityObject::fromProfile($member); $act->actor = $member->asActivityObject();
$act->verb = ActivityVerb::JOIN; $act->verb = ActivityVerb::JOIN;
$act->objects[] = ActivityObject::fromGroup($group); $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)); 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->actor->extra[] = $profile->profileInfo(null);
$act->verb = ActivityVerb::POST; $act->verb = ActivityVerb::POST;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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