From 7e69dc8fa711da59a003dc7f50a16a0e59f0f88c Mon Sep 17 00:00:00 2001 From: winter Date: Mon, 31 Mar 2025 18:48:41 +0100 Subject: hopefully fix note mentions in fetch/import push --- Digitigrade/Model/Note.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Digitigrade/Model/Note.php') 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); -- cgit v1.3