[ActivityPub] Tombstones now have datetimes
This commit is contained in:
parent
cb78573f59
commit
c3cdde0873
|
@ -79,7 +79,7 @@ class apNoticeAction extends ManagedAction
|
||||||
$this->notice = $this->getNotice();
|
$this->notice = $this->getNotice();
|
||||||
} catch (ClientException $e) {
|
} catch (ClientException $e) {
|
||||||
//ActivityPubReturn::error('Activity deleted.', 410);
|
//ActivityPubReturn::error('Activity deleted.', 410);
|
||||||
ActivityPubReturn::answer(Activitypub_tombstone::tombstone_to_array(common_local_url('apNotice', ['id' => $this->notice_id])), 410);
|
ActivityPubReturn::answer(Activitypub_tombstone::tombstone_to_array($this->notice_id), 410);
|
||||||
}
|
}
|
||||||
$this->target = $this->notice;
|
$this->target = $this->notice;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Activitypub_message
|
||||||
|
|
||||||
$tags = [];
|
$tags = [];
|
||||||
foreach ($message->getTags() as $tag) {
|
foreach ($message->getTags() as $tag) {
|
||||||
if ($tag != "") { // Hacky workaround to avoid stupid outputs
|
if ($tag != '') { // Hacky workaround to avoid stupid outputs
|
||||||
$tags[] = Activitypub_tag::tag_to_array($tag);
|
$tags[] = Activitypub_tag::tag_to_array($tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Activitypub_notice
|
||||||
'id' => self::getUri($notice),
|
'id' => self::getUri($notice),
|
||||||
'type' => 'Delete',
|
'type' => 'Delete',
|
||||||
// XXX: A bit of ugly code here
|
// XXX: A bit of ugly code here
|
||||||
'object' => array_merge(Activitypub_tombstone::tombstone_to_array(common_local_url('apNotice', ['id' => (int)substr(explode(':', $notice->getUri())[2],9)])), ['deleted' => str_replace(' ', 'T', $notice->getCreated()) . 'Z']),
|
'object' => array_merge(Activitypub_tombstone::tombstone_to_array((int)substr(explode(':', $notice->getUri())[2],9)), ['deleted' => str_replace(' ', 'T', $notice->getCreated()) . 'Z']),
|
||||||
'url' => $notice->getUrl(),
|
'url' => $notice->getUrl(),
|
||||||
'actor' => $profile->getUri(),
|
'actor' => $profile->getUri(),
|
||||||
'to' => $to,
|
'to' => $to,
|
||||||
|
|
|
@ -39,16 +39,19 @@ class Activitypub_tombstone
|
||||||
/**
|
/**
|
||||||
* Generates an ActivityPub representation of a Tombstone
|
* Generates an ActivityPub representation of a Tombstone
|
||||||
*
|
*
|
||||||
* @param string $id Activity id
|
* @param int $id Activity id
|
||||||
* @return array pretty array to be used in a response
|
* @return array pretty array to be used in a response
|
||||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||||
*/
|
*/
|
||||||
public static function tombstone_to_array(string $id): array
|
public static function tombstone_to_array(int $id): array
|
||||||
{
|
{
|
||||||
|
$dead = Deleted_notice::getByID($id);
|
||||||
$res = [
|
$res = [
|
||||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
'id' => $id,
|
'id' => Activitypub_notice::getUri($id),
|
||||||
'type' => 'Tombstone'
|
'type' => 'Tombstone',
|
||||||
|
'created' => str_replace(' ', 'T', $dead->act_created) . 'Z',
|
||||||
|
'deleted' => str_replace(' ', 'T', $dead->created) . 'Z'
|
||||||
];
|
];
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user