Moved some FAVORITE handling from Activity plugin to Favorite
This commit is contained in:
parent
89704bcdee
commit
78dc376f01
|
@ -279,10 +279,6 @@ class ActivityPlugin extends Plugin
|
||||||
$adapter = null;
|
$adapter = null;
|
||||||
|
|
||||||
switch ($notice->verb) {
|
switch ($notice->verb) {
|
||||||
case ActivityVerb::FAVORITE:
|
|
||||||
case ActivityVerb::UNFAVORITE:
|
|
||||||
$adapter = new SystemListItem($nli);
|
|
||||||
break;
|
|
||||||
case ActivityVerb::JOIN:
|
case ActivityVerb::JOIN:
|
||||||
$adapter = new JoinListItem($nli);
|
$adapter = new JoinListItem($nli);
|
||||||
break;
|
break;
|
||||||
|
@ -311,22 +307,6 @@ class ActivityPlugin extends Plugin
|
||||||
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
|
public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
|
||||||
{
|
{
|
||||||
switch ($stored->verb) {
|
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:
|
case ActivityVerb::UNFAVORITE:
|
||||||
// FIXME: do something here
|
// FIXME: do something here
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -329,8 +329,15 @@ class Fave extends Managed_DataObject
|
||||||
{
|
{
|
||||||
$target = self::getTargetFromStored($stored);
|
$target = self::getTargetFromStored($stored);
|
||||||
|
|
||||||
|
// 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->target = $target->asActivityObject();
|
||||||
$act->objects = array(clone($act->target));
|
$act->objects = array(clone($act->target));
|
||||||
|
}
|
||||||
$act->context->replyToID = $target->getUri();
|
$act->context->replyToID = $target->getUri();
|
||||||
$act->context->replyToUrl = $target->getUrl();
|
$act->context->replyToUrl = $target->getUrl();
|
||||||
$act->title = ActivityUtils::verbToTitle($act->verb);
|
$act->title = ActivityUtils::verbToTitle($act->verb);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user