$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)) {
$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)) {
$actobj = $act->objects[0];
$object = Fave::saveActivityObject($actobj, $stored);
+ $stored->object_type = ActivityUtils::resolveUri($object->getObjectType(), true);
+
return $object;
}
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
// 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.