Fixed Unnecessary queries to check permissions for media item attachments

Kirby

Well-known member
Affected version
2.1.2
\XF\Attachment\Post does implement getContainerWith(), which is great as this allows to get all the necessary data to check permissions on attachmens for a certain content type in one query.

\XFMG\Attachment\Media however does not implement this method which is a bit unfortunate as this does cause additional queries to get category/album information when calling $attachment->canView().

It would be nice if this method could be implemented.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XFMG release (2.1.4).

Change log:
When the media attachment handler is getting the attachment's container, ensure it eagerly fetches permissions and other relevant data to avoid additional queries later.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom