diff options
author | Evan Prodromou <evan@status.net> | 2010-08-04 12:07:49 -0700 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-09-13 11:44:20 -0400 |
commit | d9b959fc64e4e36b0957afd33482f480b24868f9 (patch) | |
tree | 457d229fe31f1c70e8fccd17472faf6ba93a340a /classes/Subscription.php | |
parent | 9aadd3cb4216f2917858b5a4eacfc5e3dc17a9ac (diff) |
move code for making activities from OStatus plugin to Subscription and Fave classes
Diffstat (limited to 'classes/Subscription.php')
-rw-r--r-- | classes/Subscription.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/classes/Subscription.php b/classes/Subscription.php index 0225ed4df..0044699a3 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -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; + } } |