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', {
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;

@ -19,6 +19,7 @@ interface Props {
onGoBack: () => void;
onInviteFriends: () => void;
onLeaveGroup: () => void;
onShowLightBox: (options: any) => void;
}
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) => {
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);
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<Props, any> {
};
return {
documents,
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;

Loading…
Cancel
Save