forked from GNUsocial/gnu-social
move code for making activities from OStatus plugin to Subscription and Fave classes
This commit is contained in:
@@ -235,4 +235,30 @@ class Subscription extends Memcached_DataObject
|
||||
'subscribed' => $other->id));
|
||||
return (empty($sub)) ? false : true;
|
||||
}
|
||||
|
||||
function asActivity()
|
||||
{
|
||||
$subscriber = Profile::staticGet('id', $this->subscriber);
|
||||
$subscribed = Profile::staticGet('id', $this->subscribed);
|
||||
|
||||
$act = new Activity();
|
||||
|
||||
$act->verb = ActivityVerb::FOLLOW;
|
||||
|
||||
$act->id = TagURI::mint('follow:%d:%d:%s',
|
||||
$subscriber->id,
|
||||
$subscribed->id,
|
||||
common_date_iso8601($this->created));
|
||||
|
||||
$act->time = strtotime($this->created);
|
||||
$act->title = _("Follow");
|
||||
$act->content = sprintf(_("%s is now following %s."),
|
||||
$subscriber->getBestName(),
|
||||
$subscribed->getBestName());
|
||||
|
||||
$act->actor = ActivityObject::fromProfile($subscriber);
|
||||
$act->object = ActivityObject::fromProfile($subscribed);
|
||||
|
||||
return $act;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user