Merge pull request #1332 from Bilb/message-detail-view-fixes

pull/1335/head
Audric Ackermann 5 years ago committed by GitHub
commit e3d2980910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -836,7 +836,7 @@
return Boolean(lookup[contactId]); return Boolean(lookup[contactId]);
}, },
getPropsForMessageDetail() { async getPropsForMessageDetail() {
const newIdentity = i18n('newIdentity'); const newIdentity = i18n('newIdentity');
const OUTGOING_KEY_ERROR = 'OutgoingIdentityKeyError'; const OUTGOING_KEY_ERROR = 'OutgoingIdentityKeyError';
@ -872,8 +872,8 @@
// that contact. Otherwise, it will be a standalone entry. // that contact. Otherwise, it will be a standalone entry.
const errors = _.reject(allErrors, error => Boolean(error.number)); const errors = _.reject(allErrors, error => Boolean(error.number));
const errorsGroupedById = _.groupBy(allErrors, 'number'); const errorsGroupedById = _.groupBy(allErrors, 'number');
const primaryDevicePubKey = this.get('conversationId'); const finalContacts = await Promise.all(
const finalContacts = (phoneNumbers || []).map(id => { (phoneNumbers || []).map(async id => {
const errorsForContact = errorsGroupedById[id]; const errorsForContact = errorsGroupedById[id];
const isOutgoingKeyError = Boolean( const isOutgoingKeyError = Boolean(
_.find(errorsForContact, error => error.name === OUTGOING_KEY_ERROR) _.find(errorsForContact, error => error.name === OUTGOING_KEY_ERROR)
@ -881,8 +881,11 @@
const isUnidentifiedDelivery = const isUnidentifiedDelivery =
storage.get('unidentifiedDeliveryIndicators') && storage.get('unidentifiedDeliveryIndicators') &&
this.isUnidentifiedDelivery(id, unidentifiedLookup); this.isUnidentifiedDelivery(id, unidentifiedLookup);
const primary = await window.libsession.Protocols.MultiDeviceProtocol.getPrimaryDevice(
id
);
const isPrimaryDevice = id === primaryDevicePubKey; const isPrimaryDevice = id === primary.key;
const contact = this.findAndFormatContact(id); const contact = this.findAndFormatContact(id);
const profileName = isPrimaryDevice const profileName = isPrimaryDevice
@ -904,7 +907,8 @@
onShowSafetyNumber: () => onShowSafetyNumber: () =>
this.trigger('show-identity', this.findContact(id)), this.trigger('show-identity', this.findContact(id)),
}; };
}); })
);
// The prefix created here ensures that contacts with errors are listed // The prefix created here ensures that contacts with errors are listed
// first; otherwise it's alphabetical // first; otherwise it's alphabetical

@ -1496,14 +1496,14 @@
Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el); Signal.Backbone.Views.Lightbox.show(this.lightboxGalleryView.el);
}, },
showMessageDetail(message) { async showMessageDetail(message) {
const onClose = () => { const onClose = () => {
this.stopListening(message, 'change', update); this.stopListening(message, 'change', update);
this.resetPanel(); this.resetPanel();
this.updateHeader(); this.updateHeader();
}; };
const props = message.getPropsForMessageDetail(); const props = await message.getPropsForMessageDetail();
const view = new Whisper.ReactWrapperView({ const view = new Whisper.ReactWrapperView({
className: 'message-detail-wrapper', className: 'message-detail-wrapper',
Component: Signal.Components.MessageDetail, Component: Signal.Components.MessageDetail,
@ -1511,7 +1511,8 @@
onClose, onClose,
}); });
const update = () => view.update(message.getPropsForMessageDetail()); const update = async () =>
view.update(await message.getPropsForMessageDetail());
this.listenTo(message, 'change', update); this.listenTo(message, 'change', update);
this.listenTo(message, 'expired', onClose); this.listenTo(message, 'expired', onClose);
// We could listen to all involved contacts, but we'll call that overkill // We could listen to all involved contacts, but we'll call that overkill

@ -1224,7 +1224,7 @@
} }
.module-message-detail__contact-container { .module-message-detail__contact-container {
margin: 20px; margin: 20px 0 20px 0;
} }
.module-message-detail__contact { .module-message-detail__contact {

Loading…
Cancel
Save