[AttachmentShowRelated] Bug fix after re-introduction of NoteActions
This commit is contained in:
parent
df62d7e4f4
commit
fbbbde4275
@ -24,6 +24,7 @@ namespace Plugin\AttachmentShowRelated;
|
|||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Core\Event;
|
use App\Core\Event;
|
||||||
use App\Core\Modules\Plugin;
|
use App\Core\Modules\Plugin;
|
||||||
|
use App\Util\Common;
|
||||||
use App\Util\Formatting;
|
use App\Util\Formatting;
|
||||||
|
|
||||||
class AttachmentShowRelated extends Plugin
|
class AttachmentShowRelated extends Plugin
|
||||||
@ -37,7 +38,7 @@ class AttachmentShowRelated extends Plugin
|
|||||||
$related_tags = DB::dql('select distinct t.tag ' .
|
$related_tags = DB::dql('select distinct t.tag ' .
|
||||||
'from attachment_to_note an join note_tag t with an.note_id = t.note_id ' .
|
'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']]);
|
'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]);
|
$res[] = Formatting::twigRenderFile('attachmentShowRelated/attachmentRelatedTags.html.twig', ['related_tags' => $related_tags]);
|
||||||
}
|
}
|
||||||
return Event::next;
|
return Event::next;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<div id="related-notes" style="margin: var(--unit-size);">
|
<div id="related-notes" style="margin: var(--unit-size);">
|
||||||
{{ 'Notes where this attachment appears' | trans }}
|
{{ 'Notes where this attachment appears' | trans }}
|
||||||
{% for note in related_notes %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user