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/Note.php | |
| parent | 583b1f8a865935dd4ae1b0c9fa40a4b347ea3d4d (diff) | |
implement deletion/tombstones?
Diffstat (limited to 'Digitigrade/Model/Note.php')
| -rw-r--r-- | Digitigrade/Model/Note.php | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php index 7ffb67e..9d73a89 100644 --- a/Digitigrade/Model/Note.php +++ b/Digitigrade/Model/Note.php @@ -110,15 +110,7 @@ class Note extends PushableModel { return Interaction::findAllWithTarget($this); } - /** - * Sends this note to all instances it's relevant to. - * - * For example, this may include the servers of any followers if the scope is at - * least 'followers', anyone mentioned, and anyone in the alsoVisibleTo field. - * If the scope is 'public' it may also send it to other servers? i'm not sure - * @return void - */ - public function publish() { + protected function getRelevantServers(): array { $recipientActors = match ($this->privacy->scope) { NotePrivacyScope::NONE => [], NotePrivacyScope::MUTUALS => $this->author->findMutualFollows(), @@ -129,14 +121,17 @@ class Note extends PushableModel { $instances = array_map(function (Actor $a) { return $a->findHomeInstance(); }, $recipientActors); - $instances = array_unique($instances); - - foreach ($instances as $instance) { - (new PushObject($this, $instance))->submit(); - } + return array_unique($instances); } public function jsonSerialize(): array { + if ($this->deleted) { + return [ + 'type' => 'tombstone', + 'self' => path_to_uri("/post/$this->id"), + 'previousType' => 'note' + ]; + } return [ 'type' => 'note', 'self' => path_to_uri("/post/$this->id"), |
