We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 78dc376f authored by mattl's avatar mattl

Moved some FAVORITE handling from Activity plugin to Favorite

parent 89704bcd
......@@ -279,10 +279,6 @@ class ActivityPlugin extends Plugin
$adapter = null;
switch ($notice->verb) {
case ActivityVerb::FAVORITE:
case ActivityVerb::UNFAVORITE:
$adapter = new SystemListItem($nli);
break;
case ActivityVerb::JOIN:
$adapter = new JoinListItem($nli);
break;
......@@ -311,22 +307,6 @@ class ActivityPlugin extends Plugin
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;
......
......@@ -329,8 +329,15 @@ class Fave extends Managed_DataObject
{
$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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment