showLightboxForMedia: Properly handle message events
This commit is contained in:
parent
0134990275
commit
4f3280b415
1 changed files with 16 additions and 1 deletions
|
@ -1738,8 +1738,21 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
mediaItem.attachment.path === selectedMediaItem.attachment.path
|
||||
);
|
||||
|
||||
const mediaMessage = selectedMediaItem.message;
|
||||
const message = window.MessageController.getById(mediaMessage.id);
|
||||
if (!message) {
|
||||
throw new Error(
|
||||
`showLightboxForMedia: Message ${mediaMessage.id} missing!`
|
||||
);
|
||||
}
|
||||
|
||||
const close = () => {
|
||||
closeLightbox();
|
||||
this.stopListening(message, 'expired', closeLightbox);
|
||||
};
|
||||
|
||||
showLightbox({
|
||||
close: closeLightbox,
|
||||
close,
|
||||
i18n: window.i18n,
|
||||
getConversation: getConversationSelector(window.reduxStore.getState()),
|
||||
media,
|
||||
|
@ -1749,6 +1762,8 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
onSave,
|
||||
selectedIndex: selectedIndex >= 0 ? selectedIndex : 0,
|
||||
});
|
||||
|
||||
this.listenTo(message, 'expired', close);
|
||||
}
|
||||
|
||||
showLightbox({
|
||||
|
|
Loading…
Reference in a new issue