diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-06 17:16:13 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-06 17:16:13 -0700 |
commit | 99194e03fa50b61f99164674afc949b4bbefd44a (patch) | |
tree | 2d38f6ec4b1e6f314d925233c781315541772a0f /classes/Subscription.php | |
parent | 033a7570133d4183c2e162859e9b85fe7df3e40b (diff) | |
parent | 71176b9a98ef5298162f821c621a0e467dd9570b (diff) |
Merge branch '1.0.x' into schema-x
Conflicts:
plugins/OStatus/classes/Ostatus_profile.php
Diffstat (limited to 'classes/Subscription.php')
-rw-r--r-- | classes/Subscription.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/Subscription.php b/classes/Subscription.php index 0225ed4df..e9ad2a5a2 100644 --- a/classes/Subscription.php +++ b/classes/Subscription.php @@ -235,4 +235,33 @@ 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); + // TRANS: Activity tile when subscribing to another person. + $act->title = _("Follow"); + // TRANS: Notification given when one person starts following another. + // TRANS: %1$s is the subscriber, %2$s is the subscribed. + $act->content = sprintf(_('%1$s is now following %2$s.'), + $subscriber->getBestName(), + $subscribed->getBestName()); + + $act->actor = ActivityObject::fromProfile($subscriber); + $act->objects[] = ActivityObject::fromProfile($subscribed); + + return $act; + } } |