diff options
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..f21f1b529 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->modified)); + + $act->time = strtotime($this->modified); + $act->title = _("Favor"); + $act->content = sprintf(_("%s marked notice %s as a favorite."), + $profile->getBestName(), + $notice->uri); + + $act->actor = ActivityObject::fromProfile($profile); + $act->objects[] = ActivityObject::fromNotice($notice); + + return $act; + } } |