[UI][CARD][Note] Add Conversation link

This commit is contained in:
Diogo Peralta Cordeiro 2021-12-23 17:15:35 +00:00
parent 3c79d82b80
commit 4b98200ecd
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
2 changed files with 18 additions and 1 deletions

View File

@ -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);

View File

@ -94,7 +94,7 @@
<div class="note-info">
{{ block('note_author') }}
<em>
<a href="{{ note.getUrl() }}" class="note-url">{{ 'in conversation' | trans }} {{ note.getModified() | ago }}</a>
<a href="{{ note.getConversationUrl() }}" class="note-url">{{ 'in conversation' | trans }}</a> <a href="{{ note.getUrl() }}" class="note-url">{{ note.getModified() | ago }}</a>
</em>
{{ block('note_actions') }}