[UI][NOTE] Add reply to in UI

This commit is contained in:
Hugo Sales
2020-09-06 21:34:36 +00:00
committed by Hugo Sales
parent 9573cab4cb
commit 420b4767b2
2 changed files with 23 additions and 4 deletions

View File

@@ -215,7 +215,21 @@ class Note extends Entity
public function getReplies(): array
{
return Cache::getList('note-replies-' . $this->id, function () { return DB::dql('select n from App\Entity\Note n where n.reply_to = :id', ['id' => $this->id]); });
return Cache::getList('note-replies-' . $this->id, function () {
return DB::dql('select n from App\Entity\Note n where n.reply_to = :id', ['id' => $this->id]);
});
}
public function getReplyToNickname(): ?string
{
if (!empty($this->reply_to)) {
return Cache::get('note-reply-to-' . $this->id, function () {
return DB::dql('select g from App\Entity\Note n join ' .
'App\Entity\GSActor g with n.gsactor_id = g.id where n.reply_to = :reply',
['reply' => $this->reply_to])[0]->getNickname();
});
}
return null;
}
public static function schemaDef(): array