$deleted->id = $target->getID();
$deleted->profile_id = $target->getProfile()->getID();
- $deleted->uri = Deleted_notice::newUri($target->getProfile(), $target);
+ $deleted->uri = $act->id;
$deleted->act_uri = $target->getUri();
$deleted->act_created = $target->created;
$deleted->created = common_sql_now();
return $deleted;
}
+ // FIXME: Put this in lib/activityhandlerplugin.php when we're ready
+ // with the other microapps/activityhandlers as well.
+ // Also it should be StartNoticeAsActivity (with a prepped Activity, including ->context etc.)
+ public function onEndNoticeAsActivity(Notice $stored, Activity $act, Profile $scoped=null)
+ {
+ if (!$this->isMyNotice($stored)) {
+ return true;
+ }
+
+ common_debug('Extending activity '.$stored->id.' with '.get_called_class());
+ $this->extendActivity($stored, $act, $scoped);
+ return false;
+ }
+
+ public function extendActivity(Notice $stored, Activity $act, Profile $scoped=null)
+ {
+ Deleted_notice::extendActivity($stored, $act, $scoped);
+ }
+
public function activityObjectFromNotice(Notice $notice)
{
$object = Deleted_notice::fromStored($notice);
$act->type = ActivityObject::ACTIVITY;
$act->verb = ActivityVerb::DELETE;
$act->time = time();
- $act->id = TagURI::mint('deleted_notice:%d:%d:%s',
- $actor->getID(),
- $notice->getID(),
- common_date_iso8601(common_sql_now()));
+ $act->id = self::newUri($actor, $notice);
$act->content = sprintf(_m('<a href="%1$s">%2$s</a> deleted notice <a href="%3$s">{{%4$s}}</a>.'),
htmlspecialchars($actor->getUrl()),
$actobj->actor = $this->getActorObject();
$actobj->target = new ActivityObject();
$actobj->target->id = $this->getTargetUri();
- $actobj->target->type = ActivityUtils::resolveUri(self::getObjectType());
$actobj->objects = array(clone($actobj->target));
$actobj->verb = ActivityVerb::DELETE;
$actobj->title = ActivityUtils::verbToTitle($actobj->verb);
return $actobj;
}
+ static public function extendActivity(Notice $stored, Activity $act, Profile $scoped=null)
+ {
+ $object = self::fromStored($stored);
+
+ $act->target = $object->asActivityObject();
+ $act->objects = array(clone($act->target));
+
+ $act->context->replyToID = $object->getTargetUri();
+ $act->title = ActivityUtils::verbToTitle($act->verb);
+ }
+
static function newUri(Profile $actor, Managed_DataObject $object, $created=null)
{
if (is_null($created)) {
}
return TagURI::mint(strtolower(get_called_class()).':%d:%s:%d:%s',
$actor->getID(),
- ActivityUtils::resolveUri(self::getObjectType(), true),
+ ActivityUtils::resolveUri($object->getObjectType(), true),
$object->getID(),
common_date_iso8601($created));
}