[NOTE][UI] Add note replying and UI displaying

This commit is contained in:
Hugo Sales
2020-08-28 20:16:26 +00:00
committed by Hugo Sales
parent 459f0bf41f
commit 0b50905ac8
14 changed files with 203 additions and 106 deletions

View File

@@ -21,6 +21,7 @@
namespace App\Entity;
use App\Core\Cache;
use App\Core\DB\DB;
use App\Core\Entity;
use App\Core\Event;
@@ -187,6 +188,23 @@ class Note extends Entity
return $url;
}
public function getAttachments(): array
{
return Cache::get('note-attachments-' . $this->id, function () {
return DB::dql(
'select f from App\Entity\File f ' .
'join App\Entity\FileToNote ftn with ftn.file_id = f.id ' .
'where ftn.note_id = :note_id',
['note_id' => $this->id]
);
});
}
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]); });
}
public static function schemaDef(): array
{
return [