pull/1332/head
Audric Ackermann 5 years ago
parent f43ea3d940
commit 5bab1c665f
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -872,41 +872,43 @@
// 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 finalContacts = await Promise.all((phoneNumbers || []).map(async id => { const finalContacts = await Promise.all(
const errorsForContact = errorsGroupedById[id]; (phoneNumbers || []).map(async id => {
const isOutgoingKeyError = Boolean( const errorsForContact = errorsGroupedById[id];
_.find(errorsForContact, error => error.name === OUTGOING_KEY_ERROR) const isOutgoingKeyError = Boolean(
); _.find(errorsForContact, error => error.name === OUTGOING_KEY_ERROR)
const isUnidentifiedDelivery = );
storage.get('unidentifiedDeliveryIndicators') && const isUnidentifiedDelivery =
this.isUnidentifiedDelivery(id, unidentifiedLookup); storage.get('unidentifiedDeliveryIndicators') &&
const primary = await window.libsession.Protocols.MultiDeviceProtocol.getPrimaryDevice( this.isUnidentifiedDelivery(id, unidentifiedLookup);
id const primary = await window.libsession.Protocols.MultiDeviceProtocol.getPrimaryDevice(
); id
);
const isPrimaryDevice = id === primary.key;
const contact = this.findAndFormatContact(id); const isPrimaryDevice = id === primary.key;
const profileName = isPrimaryDevice
? contact.profileName const contact = this.findAndFormatContact(id);
: `${contact.profileName} (Secondary Device)`; const profileName = isPrimaryDevice
return { ? contact.profileName
...contact, : `${contact.profileName} (Secondary Device)`;
status: this.getStatus(id), return {
errors: errorsForContact, ...contact,
isOutgoingKeyError, status: this.getStatus(id),
isUnidentifiedDelivery, errors: errorsForContact,
isPrimaryDevice, isOutgoingKeyError,
profileName, isUnidentifiedDelivery,
onSendAnyway: () => isPrimaryDevice,
this.trigger('force-send', { profileName,
contact: this.findContact(id), onSendAnyway: () =>
message: this, this.trigger('force-send', {
}), contact: this.findContact(id),
onShowSafetyNumber: () => message: this,
this.trigger('show-identity', this.findContact(id)), }),
}; onShowSafetyNumber: () =>
})); 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

@ -1511,7 +1511,8 @@
onClose, onClose,
}); });
const update = async () => view.update(await 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

Loading…
Cancel
Save