X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FFave.php;h=f21f1b5297613019a3efc2cc59072d1e2387ee1d;hb=8fc904e95b66ac4ce97fa3b493797da9aa0a54af;hp=7ca9ade7f04b846c53982c8507fce5293436d793;hpb=7277b59734cf0e39c8c77e01b13e8d997533bacf;p=quix0rs-gnu-social.git diff --git a/classes/Fave.php b/classes/Fave.php index 7ca9ade7f0..f21f1b5297 100644 --- a/classes/Fave.php +++ b/classes/Fave.php @@ -75,13 +75,13 @@ class Fave extends Memcached_DataObject return Memcached_DataObject::pkeyGet('Fave', $kv); } - function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false) + function stream($user_id, $offset=0, $limit=NOTICES_PER_PAGE, $own=false, $since_id=0, $max_id=0) { $ids = Notice::stream(array('Fave', '_streamDirect'), array($user_id, $own), ($own) ? 'fave:ids_by_user_own:'.$user_id : 'fave:ids_by_user:'.$user_id, - $offset, $limit); + $offset, $limit, $since_id, $max_id); return $ids; } @@ -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; + } }