forked from GNUsocial/gnu-social
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.
This commit is contained in:
parent
1ee79dc379
commit
c96f0aa30f
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user