$rprofile = Profile::staticGet('id', $id);
if (!empty($rprofile)) {
$ctx->attention[] = $rprofile->getUri();
+ $ctx->attentionType[$rprofile->getUri()] = ActivityObject::PERSON;
}
}
foreach ($groups as $group) {
$ctx->attention[] = $group->getUri();
+ $ctx->attentionType[$group->getUri()] = ActivityObject::GROUP;
+ }
+
+ switch ($this->scope) {
+ case Notice::PUBLIC_SCOPE:
+ $ctx->attention[] = "http://activityschema.org/collection/public";
+ $ctx->attentionType["http://activityschema.org/collection/public"] = ActivityObject::COLLECTION;
+ break;
+ case Notice::FOLLOWER_SCOPE:
+ $surl = common_local_url("subscribers", array('nickname' => $profile->nickname));
+ $ctx->attention[] = $surl;
+ $ctx->attentionType[$surl] = ActivityObject::COLLECTION;
+ break;
}
// XXX: deprecated; use ActivityVerb::SHARE instead
public $replyToUrl;
public $location;
public $attention = array();
+ public $attentionType = array();
public $conversation;
public $forwardID; // deprecated, use ActivityVerb::SHARE instead
public $forwardUrl; // deprecated, use ActivityVerb::SHARE instead
+ public $scope;
const THR = 'http://purl.org/syndication/thread/1.0';
const GEORSS = 'http://www.georss.org/georss';
$tos = array();
foreach ($this->attention as $attnUrl) {
+ if (array_key_exists($attnUrl, $this->attentionType)) {
+ $type = ActivityObject::canonicalType($this->attentionType[$attnUrl]);
+ } else {
+ $type = ActivityObject::canonicalType(ActivityObject::PERSON);
+ }
$to = array(
- 'objectType' => 'person',
- 'id' => $attnUrl,
- 'url' => $attnUrl
+ 'objectType' => $type,
+ 'id' => $attnUrl
);
$tos[] = $to;
}
const ACTIVITY = 'http://activitystrea.ms/schema/1.0/activity';
const SERVICE = 'http://activitystrea.ms/schema/1.0/service';
const IMAGE = 'http://activitystrea.ms/schema/1.0/image';
+ const COLLECTION = 'http://activitystrea.ms/schema/1.0/collection';
// Atom elements we snarf
$object->poco = PoCo::fromProfile($profile);
+ if ($profile->getUser()) {
+ $object->extra[] = array('followers', array('url' => common_local_url('subscribers', array('nickname' => $profile->nickname))));
+ }
+
Event::handle('EndActivityObjectFromProfile', array($profile, &$object));
}
// downstreamDuplicates
// id
- $object['id'] = $this->id;
+
+ if ($this->id) {
+ $object['id'] = $this->id;
+ } else if ($this->link) {
+ $object['id'] = $this->link;
+ }
if ($this->type == ActivityObject::PERSON
|| $this->type == ActivityObject::GROUP) {