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/Fave.php | |
parent | 9aadd3cb4216f2917858b5a4eacfc5e3dc17a9ac (diff) |
move code for making activities from OStatus plugin to Subscription and Fave classes
Diffstat (limited to 'classes/Fave.php')
-rw-r--r-- | classes/Fave.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/classes/Fave.php b/classes/Fave.php index ed4f56aee..9d0b0aa02 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -129,4 +129,29 @@ class Fave extends Memcached_DataObject return $ids; } + + function asActivity() + { + $notice = Notice::staticGet('id', $this->notice_id); + $profile = Profile::staticGet('id', $this->user_id); + + $act = new Activity(); + + $act->verb = ActivityVerb::FAVORITE; + $act->id = TagURI::mint('favor:%d:%d:%s', + $profile->id, + $notice->id, + common_date_iso8601($this->created)); + + $act->time = $this->created; + $act->title = _("Favor"); + $act->content = sprintf(_("%s marked notice %s as a favorite."), + $profile->getBestName(), + $notice->uri); + + $act->actor = ActivityObject::fromProfile($profile); + $act->object = ActivityObject::fromNotice($notice); + + return $act; + } } |