diff options
| author | winter | 2024-12-20 17:57:36 +0000 |
|---|---|---|
| committer | winter | 2024-12-20 18:01:26 +0000 |
| commit | 8ca2452dd05f614d55d2fd3ce188d9d04f44d285 (patch) | |
| tree | 7c850737c216df179ce00fa874b1de508894eb71 /Digitigrade/Model/Interaction.php | |
| parent | 583b1f8a865935dd4ae1b0c9fa40a4b347ea3d4d (diff) | |
implement deletion/tombstones?
Diffstat (limited to 'Digitigrade/Model/Interaction.php')
| -rw-r--r-- | Digitigrade/Model/Interaction.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Digitigrade/Model/Interaction.php b/Digitigrade/Model/Interaction.php index bf0745e..38065c1 100644 --- a/Digitigrade/Model/Interaction.php +++ b/Digitigrade/Model/Interaction.php @@ -47,7 +47,22 @@ class Interaction extends PushableModel { return self::findAllWhere('target = ?', [$target->id]); } + protected function getRelevantServers(): array { + $instances = array_map(function (Actor $actor) { + return Instance::findByHostname(hostname_from_uri($actor->uri)); + }, $this->author->findFollowers()); + $instances[] = Instance::findByHostname(hostname_from_uri($this->target->uri)); + return $instances; + } + public function jsonSerialize(): array { + if ($this->deleted) { + return [ + 'type' => 'tombstone', + 'self' => path_to_uri("/interaction/$this->id"), + 'previousType' => 'interaction' + ]; + } return [ 'type' => 'interaction', 'self' => path_to_uri("/interaction/$this->id"), |
