aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Model/Note.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/Model/Note.php')
-rw-r--r--Digitigrade/Model/Note.php23
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"),