diff --git a/src/Entity/Note.php b/src/Entity/Note.php index 0d1b2caa8c..957f40e38e 100644 --- a/src/Entity/Note.php +++ b/src/Entity/Note.php @@ -27,9 +27,11 @@ use App\Core\Cache; use App\Core\DB\DB; use App\Core\Entity; use App\Core\Event; +use App\Core\Router\Router; use App\Core\VisibilityScope; use App\Util\Formatting; use Component\Avatar\Avatar; +use Component\Conversation\Entity\Conversation; use DateTimeInterface; /** @@ -218,6 +220,21 @@ class Note extends Entity // @codeCoverageIgnoreEnd // }}} Autocode + public function getConversation(): Conversation + { + return Conversation::getByPK(['id' => $this->getConversationId()]); + } + + public function getConversationUrl(int $type = Router::ABSOLUTE_URL): ?string + { + return Router::url('conversation', ['conversation_id' => $this->getConversationId()], $type); + } + + public function getConversationUri(): string + { + return $this->getConversationUrl(type: Router::ABSOLUTE_URL); + } + public function getActor(): Actor { return Actor::getById($this->actor_id); diff --git a/templates/cards/note/view.html.twig b/templates/cards/note/view.html.twig index 96aad8109d..7ee814d3e7 100644 --- a/templates/cards/note/view.html.twig +++ b/templates/cards/note/view.html.twig @@ -94,7 +94,7 @@