[AttachmentShowRelated] Move Attachment related to plugin

This commit is contained in:
2021-04-30 01:51:59 +01:00
committed by Hugo Sales
parent 29a215534d
commit 8cb64ede7f
6 changed files with 70 additions and 18 deletions

View File

@@ -59,16 +59,11 @@ class Attachment extends Controller
$attachment = DB::findOneBy('attachment', ['id' => $id]);
return $this->attachment($id, function ($res) use ($id, $attachment) {
return [
'_template' => 'attachments/show.html.twig',
'title' => $res['title'],
'download' => Router::url('attachment_download', ['id' => $id]),
'attachment' => $attachment,
'related_notes' => DB::dql('select n from attachment_to_note an ' .
'join note n with n.id = an.note_id ' .
'where an.attachment_id = :attachment_id', ['attachment_id' => $id]),
'related_tags' => DB::dql('select distinct t.tag ' .
'from attachment_to_note an join note_tag t with an.note_id = t.note_id ' .
'where an.attachment_id = :attachment_id', ['attachment_id' => $id]),
'_template' => 'attachments/show.html.twig',
'title' => $res['title'],
'download' => Router::url('attachment_download', ['id' => $id]),
'attachment' => $attachment,
'right_panel_vars' => ['attachment_id' => $id],
];
});
} catch (NotFoundException) {