@@ -45,6 +45,7 @@ import { AttachmentDownloadUrgency } from '../../types/AttachmentDownload';
4545import { queueAttachmentDownloads } from '../../util/queueAttachmentDownloads' ;
4646import { getMessageIdForLogging } from '../../util/idForLogging' ;
4747import { markViewOnceMessageViewed } from '../../services/MessageUpdater' ;
48+ import type { MessageModel } from '../../models/messages' ;
4849
4950// eslint-disable-next-line local-rules/type-alias-readonlydeep
5051export type LightboxStateType =
@@ -203,6 +204,8 @@ function showLightboxForViewOnceMedia(
203204
204205 const { contentType } = tempAttachment ;
205206
207+ const authorId = getAuthorId ( message ) ;
208+
206209 const media = [
207210 {
208211 attachment : tempAttachment ,
@@ -215,6 +218,7 @@ function showLightboxForViewOnceMedia(
215218 attachments : message . get ( 'attachments' ) || [ ] ,
216219 id : message . get ( 'id' ) ,
217220 conversationId : message . get ( 'conversationId' ) ,
221+ authorId,
218222 receivedAt : message . get ( 'received_at' ) ,
219223 receivedAtMs : Number ( message . get ( 'received_at_ms' ) ) ,
220224 sentAt : message . get ( 'sent_at' ) ,
@@ -235,6 +239,16 @@ function showLightboxForViewOnceMedia(
235239 } ;
236240}
237241
242+ function getAuthorId ( message : MessageModel ) {
243+ return (
244+ window . ConversationController . lookupOrCreate ( {
245+ serviceId : message . get ( 'sourceServiceId' ) ,
246+ e164 : message . get ( 'source' ) ,
247+ reason : 'conversation_view.showLightBox' ,
248+ } ) ?. id || message . get ( 'conversationId' )
249+ ) ;
250+ }
251+
238252function filterValidAttachments (
239253 attributes : ReadonlyMessageAttributesType
240254) : Array < AttachmentType > {
@@ -297,12 +311,8 @@ function showLightbox(opts: {
297311 const attachments = filterValidAttachments ( message . attributes ) ;
298312 const loop = isGIF ( attachments ) ;
299313
300- const authorId =
301- window . ConversationController . lookupOrCreate ( {
302- serviceId : message . get ( 'sourceServiceId' ) ,
303- e164 : message . get ( 'source' ) ,
304- reason : 'conversation_view.showLightBox' ,
305- } ) ?. id || message . get ( 'conversationId' ) ;
314+ const authorId = getAuthorId ( message ) ;
315+ const conversationId = message . get ( 'conversationId' ) ;
306316 const receivedAt = message . get ( 'received_at' ) ;
307317 const sentAt = message . get ( 'sent_at' ) ;
308318
@@ -322,7 +332,8 @@ function showLightbox(opts: {
322332 message : {
323333 attachments : message . get ( 'attachments' ) || [ ] ,
324334 id : messageId ,
325- conversationId : authorId ,
335+ conversationId,
336+ authorId,
326337 receivedAt,
327338 receivedAtMs : Number ( message . get ( 'received_at_ms' ) ) ,
328339 sentAt,
0 commit comments