diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index cac7fbff1..63fc52318 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -260,7 +260,7 @@ window.Whisper.events.trigger('onShowUserDetails', { userPubKey: pubkey, }); - } else { + } else if (!this.model.isRss()){ this.showGroupSettings(); } }, @@ -285,6 +285,7 @@ isPublic: this.model.isPublic(), isRss: this.model.isRss(), memberCount: members.length, + /* timerOptions: Whisper.ExpirationTimerOptions.map(item => ({ name: item.getName(), value: item.get('seconds'), @@ -309,6 +310,9 @@ onInviteFriends: () => { window.Whisper.events.trigger('inviteFriends', this.model); }, + onShowLightBox: (lightBoxOptions = {}) => { + this.showChannelLightbox(lightBoxOptions); + }, }; }; this.titleView = new Whisper.ReactWrapperView({ @@ -1263,7 +1267,6 @@ toast.render(); return; } - Signal.Types.Attachment.save({ attachment, document, @@ -1355,6 +1358,23 @@ this.deleteMessages([message]); }, + showChannelLightbox({ media, attachment, message }) { + const selectedIndex = media.findIndex( + mediaMessage => mediaMessage.attachment.path === attachment.path + ); + this.lightboxGalleryView = new Whisper.ReactWrapperView({ + className: 'lightbox-wrapper', + Component: Signal.Components.LightboxGallery, + props: { + media, + onSave: () => this.downloadAttachment({ attachment, message }), + selectedIndex, + }, + onClose: () => Signal.Backbone.Views.Lightbox.hide(), + }); + Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el); + }, + showLightbox({ attachment, message }) { const { contentType, path } = attachment; diff --git a/ts/components/session/SessionChannelSettings.tsx b/ts/components/session/SessionChannelSettings.tsx index 98b5dc96c..a7ca2278d 100644 --- a/ts/components/session/SessionChannelSettings.tsx +++ b/ts/components/session/SessionChannelSettings.tsx @@ -19,6 +19,7 @@ interface Props { onGoBack: () => void; onInviteFriends: () => void; onLeaveGroup: () => void; + onShowLightBox: (options: any) => void; } export class SessionChannelSettings extends React.Component { @@ -147,29 +148,18 @@ export class SessionChannelSettings extends React.Component { const onItemClick = async ({ message, attachment, type }: any) => { switch (type) { - case 'documents': - case 'media': { + case 'documents': { saveAttachment({ message, attachment }).ignore(); break; } - /*case 'media': { - const selectedIndex = media.findIndex( - mediaMessage => mediaMessage.attachment.path === attachment.path - ); - this.lightboxGalleryView = new Whisper.ReactWrapperView({ - className: 'lightbox-wrapper', - Component: Signal.Components.LightboxGallery, - props: { - media, - onSave: saveAttachment, - selectedIndex, - }, - onClose: () => Signal.Backbone.Views.Lightbox.hide(), - }); - Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el); - break; - }*/ + case 'media': { + const lightBoxOptions = { + media, attachment, message, + }; + this.onShowLightBox(lightBoxOptions); + break; + } default: throw new TypeError(`Unknown attachment type: '${type}'`); @@ -177,12 +167,16 @@ export class SessionChannelSettings extends React.Component { }; return { - documents, - media, - onItemClick, + media, + documents, + onItemClick, }; } + public onShowLightBox(options: any) { + this.props.onShowLightBox(options); + } + public render() { const { memberCount, name, onLeaveGroup } = this.props; const { documents, media, onItemClick } = this.state;