enable back lightbox on groupsettings panel to see group medias

pull/715/head
Audric Ackermann 6 years ago
parent 213db6c1ed
commit 86e39ce4e2

@ -260,7 +260,7 @@
window.Whisper.events.trigger('onShowUserDetails', { window.Whisper.events.trigger('onShowUserDetails', {
userPubKey: pubkey, userPubKey: pubkey,
}); });
} else { } else if (!this.model.isRss()){
this.showGroupSettings(); this.showGroupSettings();
} }
}, },
@ -285,6 +285,7 @@
isPublic: this.model.isPublic(), isPublic: this.model.isPublic(),
isRss: this.model.isRss(), isRss: this.model.isRss(),
memberCount: members.length, memberCount: members.length,
/* timerOptions: Whisper.ExpirationTimerOptions.map(item => ({ /* timerOptions: Whisper.ExpirationTimerOptions.map(item => ({
name: item.getName(), name: item.getName(),
value: item.get('seconds'), value: item.get('seconds'),
@ -309,6 +310,9 @@
onInviteFriends: () => { onInviteFriends: () => {
window.Whisper.events.trigger('inviteFriends', this.model); window.Whisper.events.trigger('inviteFriends', this.model);
}, },
onShowLightBox: (lightBoxOptions = {}) => {
this.showChannelLightbox(lightBoxOptions);
},
}; };
}; };
this.titleView = new Whisper.ReactWrapperView({ this.titleView = new Whisper.ReactWrapperView({
@ -1263,7 +1267,6 @@
toast.render(); toast.render();
return; return;
} }
Signal.Types.Attachment.save({ Signal.Types.Attachment.save({
attachment, attachment,
document, document,
@ -1355,6 +1358,23 @@
this.deleteMessages([message]); 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 }) { showLightbox({ attachment, message }) {
const { contentType, path } = attachment; const { contentType, path } = attachment;

@ -19,6 +19,7 @@ interface Props {
onGoBack: () => void; onGoBack: () => void;
onInviteFriends: () => void; onInviteFriends: () => void;
onLeaveGroup: () => void; onLeaveGroup: () => void;
onShowLightBox: (options: any) => void;
} }
export class SessionChannelSettings extends React.Component<Props, any> { export class SessionChannelSettings extends React.Component<Props, any> {
@ -147,29 +148,18 @@ export class SessionChannelSettings extends React.Component<Props, any> {
const onItemClick = async ({ message, attachment, type }: any) => { const onItemClick = async ({ message, attachment, type }: any) => {
switch (type) { switch (type) {
case 'documents': case 'documents': {
case 'media': {
saveAttachment({ message, attachment }).ignore(); saveAttachment({ message, attachment }).ignore();
break; break;
} }
/*case 'media': { case 'media': {
const selectedIndex = media.findIndex( const lightBoxOptions = {
mediaMessage => mediaMessage.attachment.path === attachment.path media, attachment, message,
); };
this.lightboxGalleryView = new Whisper.ReactWrapperView({ this.onShowLightBox(lightBoxOptions);
className: 'lightbox-wrapper', break;
Component: Signal.Components.LightboxGallery, }
props: {
media,
onSave: saveAttachment,
selectedIndex,
},
onClose: () => Signal.Backbone.Views.Lightbox.hide(),
});
Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el);
break;
}*/
default: default:
throw new TypeError(`Unknown attachment type: '${type}'`); throw new TypeError(`Unknown attachment type: '${type}'`);
@ -177,12 +167,16 @@ export class SessionChannelSettings extends React.Component<Props, any> {
}; };
return { return {
documents, media,
media, documents,
onItemClick, onItemClick,
}; };
} }
public onShowLightBox(options: any) {
this.props.onShowLightBox(options);
}
public render() { public render() {
const { memberCount, name, onLeaveGroup } = this.props; const { memberCount, name, onLeaveGroup } = this.props;
const { documents, media, onItemClick } = this.state; const { documents, media, onItemClick } = this.state;

Loading…
Cancel
Save