$adapter = null;
switch ($notice->verb) {
- case ActivityVerb::FAVORITE:
- case ActivityVerb::UNFAVORITE:
- $adapter = new SystemListItem($nli);
- break;
case ActivityVerb::JOIN:
$adapter = new JoinListItem($nli);
break;
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
{
switch ($stored->verb) {
- case ActivityVerb::FAVORITE:
- $fave = Fave::getKV('uri', $stored->uri);
- if (!empty($fave)) {
- $stored = Notice::getKV('id', $fave->notice_id);
- if (!empty($stored)) {
- $target = $stored->asActivity($scoped);
- if ($target->verb == ActivityVerb::POST) {
- // "I like the thing you posted"
- $act->objects = $target->objects;
- } else {
- // "I like that you did whatever you did"
- $act->objects = array($target);
- }
- }
- }
- break;
case ActivityVerb::UNFAVORITE:
// FIXME: do something here
break;
{
$target = self::getTargetFromStored($stored);
- $act->target = $target->asActivityObject();
- $act->objects = array(clone($act->target));
+ // The following logic was copied from StatusNet's Activity plugin
+ if (ActivityUtils::compareTypes($target->verb, array(ActivityVerb::POST))) {
+ // "I like the thing you posted"
+ $act->objects = $target->asActivity()->objects;
+ } else {
+ // "I like that you did whatever you did"
+ $act->target = $target->asActivityObject();
+ $act->objects = array(clone($act->target));
+ }
$act->context->replyToID = $target->getUri();
$act->context->replyToUrl = $target->getUrl();
$act->title = ActivityUtils::verbToTitle($act->verb);