[UI][CARD][Note] Add Conversation link
This commit is contained in:
parent
3c79d82b80
commit
4b98200ecd
|
@ -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);
|
||||
|
|
|
@ -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') }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user