diff options
| author | winter | 2025-03-31 18:48:41 +0100 |
|---|---|---|
| committer | winter | 2025-03-31 18:48:41 +0100 |
| commit | 7e69dc8fa711da59a003dc7f50a16a0e59f0f88c (patch) | |
| tree | c1b69d93019c6731f2014681c58c36ef8b92f0d7 /Digitigrade/Model/Note.php | |
| parent | 6f094ad28ea6fe44b1c5bb446a98f15bc22246b0 (diff) | |
hopefully fix note mentions in fetch/import push
Diffstat (limited to 'Digitigrade/Model/Note.php')
| -rw-r--r-- | Digitigrade/Model/Note.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php index 4675546..6246795 100644 --- a/Digitigrade/Model/Note.php +++ b/Digitigrade/Model/Note.php @@ -101,6 +101,17 @@ class Note extends PushableModel implements TimelineIncludeable, Notifyable { $this->saveFormattedContents(); } + protected function finaliseAfterFetch(string $uri, ?\stdClass $data = null) { + // have to set up mentions here because it's not able to automatically map Actor[] ? + $this->mentions = []; + foreach (($data->mentions ?? []) as $actorUri) { + $actor = Actor::findByUri($actorUri); + if ($actor != null) { + $this->mentions[] = $actor; + } + } + } + protected function validate(): bool { // author has to be from the same instance as the note itself return hostname_from_uri($this->author->uri) == hostname_from_uri($this->uri); |
