Notice properties set in bad order on activityobject saving
This commit is contained in:
parent
0ff11ac978
commit
2821be2bce
|
@ -902,6 +902,12 @@ class Notice extends Managed_DataObject
|
|||
$stored->insert(); // throws exception on error
|
||||
$orig = clone($stored); // for updating later in this try clause
|
||||
|
||||
$object = null;
|
||||
Event::handle('StoreActivityObject', array($act, $stored, $options, &$object));
|
||||
if (empty($object)) {
|
||||
throw new ServerException('Unsuccessful call to StoreActivityObject '.$stored->uri . ': '.$act->asString());
|
||||
}
|
||||
|
||||
// If it's not part of a conversation, it's
|
||||
// the beginning of a new conversation.
|
||||
if (empty($stored->conversation)) {
|
||||
|
@ -910,12 +916,6 @@ class Notice extends Managed_DataObject
|
|||
$stored->conversation = $conv->id;
|
||||
}
|
||||
|
||||
$object = null;
|
||||
Event::handle('StoreActivityObject', array($act, $stored, $options, &$object));
|
||||
if (empty($object)) {
|
||||
throw new ServerException('Unsuccessful call to StoreActivityObject '.$stored->uri . ': '.$act->asString());
|
||||
}
|
||||
$stored->object_type = ActivityUtils::resolveUri($object->getObjectType(), true);
|
||||
$stored->update($orig);
|
||||
} catch (Exception $e) {
|
||||
if (empty($stored->id)) {
|
||||
|
|
|
@ -194,6 +194,8 @@ class FavoritePlugin extends ActivityVerbHandlerPlugin
|
|||
$actobj = $act->objects[0];
|
||||
|
||||
$object = Fave::saveActivityObject($actobj, $stored);
|
||||
$stored->object_type = ActivityUtils::resolveUri($object->getObjectType(), true);
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,14 @@ class SharePlugin extends ActivityVerbHandlerPlugin
|
|||
return array(ActivityVerb::SHARE);
|
||||
}
|
||||
|
||||
// Share is a bit special and $act->objects[0] should be an Activity
|
||||
// instead of ActivityObject! Therefore also $act->objects[0]->type is not set.
|
||||
public function isMyActivity(Activity $act) {
|
||||
return (count($act->objects) == 1
|
||||
&& ($act->objects[0] instanceof Activity)
|
||||
&& $this->isMyVerb($act->verb));
|
||||
}
|
||||
|
||||
public function onRouterInitialized(URLMapper $m)
|
||||
{
|
||||
// Web UI actions
|
||||
|
@ -125,6 +133,8 @@ class SharePlugin extends ActivityVerbHandlerPlugin
|
|||
// Setting this here because when the algorithm gets back to
|
||||
// Notice::saveActivity it will update the Notice object.
|
||||
$stored->repeat_of = $sharedNotice->getID();
|
||||
$stored->conversation = $sharedNotice->conversation;
|
||||
$stored->object_type = ActivityUtils::resolveUri(ActivityObject::ACTIVITY, true);
|
||||
|
||||
// We don't have to save a repeat in a separate table, we can
|
||||
// find repeats by just looking at the notice.repeat_of field.
|
||||
|
|
Loading…
Reference in New Issue
Block a user