diff --git a/classes/Notice.php b/classes/Notice.php
index 7a3dc2bc0f..1d9823c79c 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -286,6 +286,12 @@ class Notice extends Managed_DataObject
: $this->object_type;
}
+ // activity plugins tend to use this function instead, but it's the same
+ public function getObjectType()
+ {
+ return $this->get_object_type();
+ }
+
public static function getByUri($uri)
{
$notice = new Notice();
diff --git a/plugins/ActivityModeration/ActivityModerationPlugin.php b/plugins/ActivityModeration/ActivityModerationPlugin.php
index 64e065d305..dc21b11552 100644
--- a/plugins/ActivityModeration/ActivityModerationPlugin.php
+++ b/plugins/ActivityModeration/ActivityModerationPlugin.php
@@ -96,7 +96,7 @@ class ActivityModerationPlugin extends ActivityVerbHandlerPlugin
$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();
@@ -112,6 +112,25 @@ class ActivityModerationPlugin extends ActivityVerbHandlerPlugin
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);
diff --git a/plugins/ActivityModeration/classes/Deleted_notice.php b/plugins/ActivityModeration/classes/Deleted_notice.php
index e3723a329f..c4f12b14b0 100644
--- a/plugins/ActivityModeration/classes/Deleted_notice.php
+++ b/plugins/ActivityModeration/classes/Deleted_notice.php
@@ -69,10 +69,7 @@ class Deleted_notice extends Managed_DataObject
$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('%2$s deleted notice {{%4$s}}.'),
htmlspecialchars($actor->getUrl()),
@@ -153,7 +150,6 @@ class Deleted_notice extends Managed_DataObject
$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);
@@ -168,6 +164,17 @@ class Deleted_notice extends Managed_DataObject
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)) {
@@ -175,7 +182,7 @@ class Deleted_notice extends Managed_DataObject
}
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));
}