[AttachmentShowRelated] Bug fix after re-introduction of NoteActions

This commit is contained in:
Diogo Peralta Cordeiro 2021-08-11 23:42:08 +01:00 committed by Hugo Sales
parent df62d7e4f4
commit fbbbde4275
Signed by untrusted user: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ namespace Plugin\AttachmentShowRelated;
use App\Core\DB\DB;
use App\Core\Event;
use App\Core\Modules\Plugin;
use App\Util\Common;
use App\Util\Formatting;
class AttachmentShowRelated extends Plugin
@ -37,7 +38,7 @@ class AttachmentShowRelated extends Plugin
$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' => $vars['vars']['attachment_id']]);
$res[] = Formatting::twigRenderFile('attachmentShowRelated/attachmentRelatedNotes.html.twig', ['related_notes' => $related_notes]);
$res[] = Formatting::twigRenderFile('attachmentShowRelated/attachmentRelatedNotes.html.twig', ['related_notes' => $related_notes, 'have_user' => Common::user() !== null]);
$res[] = Formatting::twigRenderFile('attachmentShowRelated/attachmentRelatedTags.html.twig', ['related_tags' => $related_tags]);
}
return Event::next;

View File

@ -1,6 +1,6 @@
<div id="related-notes" style="margin: var(--unit-size);">
{{ 'Notes where this attachment appears' | trans }}
{% for note in related_notes %}
{% include '/note/view.html.twig' with {'note' : note, 'hide_attachments': true} only %}
{% include '/note/view.html.twig' with {'note' : note, 'hide_attachments': true, 'have_user': have_user} only %}
{% endfor %}
</div>