Format message details to show secondary pubkey properly

pull/443/head
sachaaaaa 6 years ago
parent 5eab2098b6
commit dce8c8bcf7

@ -912,6 +912,7 @@
// 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 = (phoneNumbers || []).map(id => { const finalContacts = (phoneNumbers || []).map(id => {
const errorsForContact = errorsGroupedById[id]; const errorsForContact = errorsGroupedById[id];
const isOutgoingKeyError = Boolean( const isOutgoingKeyError = Boolean(
@ -921,12 +922,20 @@
storage.get('unidentifiedDeliveryIndicators') && storage.get('unidentifiedDeliveryIndicators') &&
this.isUnidentifiedDelivery(id, unidentifiedLookup); this.isUnidentifiedDelivery(id, unidentifiedLookup);
const isPrimaryDevice = id === primaryDevicePubKey;
const contact = this.findAndFormatContact(id);
const profileName = isPrimaryDevice
? contact.profileName
: `${contact.profileName} (Secondary Device)`;
return { return {
...this.findAndFormatContact(id), ...contact,
status: this.getStatus(id), status: this.getStatus(id),
errors: errorsForContact, errors: errorsForContact,
isOutgoingKeyError, isOutgoingKeyError,
isUnidentifiedDelivery, isUnidentifiedDelivery,
isPrimaryDevice,
profileName,
onSendAnyway: () => onSendAnyway: () =>
this.trigger('force-send', { this.trigger('force-send', {
contact: this.findContact(id), contact: this.findContact(id),
@ -941,7 +950,8 @@
// first; otherwise it's alphabetical // first; otherwise it's alphabetical
const sortedContacts = _.sortBy( const sortedContacts = _.sortBy(
finalContacts, finalContacts,
contact => `${contact.errors ? '0' : '1'}${contact.title}` contact =>
`${contact.isPrimaryDevice ? '0' : '1'}${contact.phoneNumber}`
); );
return { return {

Loading…
Cancel
Save