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

Commit c96f0aa3 authored by mattl's avatar mattl

More Activity-based reasoning for saveActivity in Notice

If we can, get the activity ID from the activity itself, instead of the
supplied $options array.
parent 1ee79dc3
......@@ -712,24 +712,22 @@ class Notice extends Managed_DataObject
'and post again in a few minutes.'));
}
/* This interferes with stuff like Favorites from old StatusNet installations (first object in objects is the favored notice)
// Get ActivityObject properties
$actobj = count($act->objects)==1 ? $act->objects[0] : null;
if (!is_null($actobj) && $actobj->id) {
$options['uri'] = $actobj->id;
if ($actobj->link) {
$options['url'] = $actobj->link;
} elseif ($act->link) {
$options['url'] = $act->link;
} elseif (preg_match('!^https?://!', $actobj->id)) {
$options['url'] = $actobj->id;
}
} else {
if (!empty($act->id)) {
// implied object
$options['uri'] = $act->id;
$options['url'] = $act->link;
} else {
$actobj = count($act->objects)==1 ? $act->objects[0] : null;
if (!is_null($actobj) && !empty($actobj->id)) {
$options['uri'] = $actobj->id;
if ($actobj->link) {
$options['url'] = $actobj->link;
} elseif (preg_match('!^https?://!', $actobj->id)) {
$options['url'] = $actobj->id;
}
}
}
*/
$defaults = array(
'groups' => array(),
......
......@@ -244,6 +244,9 @@ class Activity
if (!empty($targetEl)) {
$this->target = new ActivityObject($targetEl);
} elseif (ActivityUtils::compareTypes($this->verb, array(ActivityVerb::FAVORITE))) {
// StatusNet didn't send a 'target' for their Favorite atom entries
$this->target = clone($this->objects[0]);
}
$this->summary = ActivityUtils::childContent($entry, 'summary');
......
......@@ -179,9 +179,6 @@ class FavoritePlugin extends ActivityHandlerPlugin
if (!isset($options['created'])) {
$options['created'] = !empty($act->time) ? common_sql_date($act->time) : common_sql_now();
}
if (!isset($options['uri'])) {
$options['uri'] = !empty($act->id) ? $act->id : $act->selfLink;
}
// We must have an objects[0] here because in isMyActivity we require the count to be == 1
$actobj = $act->objects[0];
......
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