Fixed Lightbox unconditionally initialized for no apparent reason in template thread_view

Kirby

Well-known member
Affected version
2.1.10
Template thread_view does contain the following code:
Code:
<xf:macro template="lightbox_macros" name="setup" arg-canViewAttachments="{$thread.canViewAttachments()}" />
which does load the lightbox JS & CSS even if the thread does not have any attachment or image.

This seems unnecessary as the BB-Code templates for [img] and [attach] as well as macro do call macro lightbox_macros:single_image which does the initialization on demand;
same is true for macro attachment_macros:attachment_list_item which does directly call lightbox_macros:setup
 
This has been changed in 2.2, but worth noting that it wasn't exactly unnecessary -- it required additional changes to retroactively activate the lightbox on the container element that already existed.
 
Top Bottom