lightbox: Only open the first returned media element.

This commit is contained in:
Karl Stolley 2024-09-27 11:43:33 -05:00 committed by Tim Abbott
parent cc877f9c83
commit c36c561f07
1 changed files with 8 additions and 1 deletions

View File

@ -671,7 +671,14 @@ export function initialize(): void {
return;
}
open_image($original_media_element);
// Because a user could conceivably copy and paste a media reference
// from another message, and because we are selecting the original
// element above based on a data-url value that is therefore not
// guaranteed to be unique, we pass the first (possibly only) media
// element returned. The logic below for removing and adding the
// "selected" class ensures that the correct thumbnail will
// still be highlighted.
open_image($original_media_element.first());
if (!$(".image-list .image.selected").hasClass("lightbox_video") || !is_video) {
pan_zoom_control.reset();