From dce8c8bcf70eac772be617f411429ae871659723 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Tue, 27 Aug 2019 15:24:31 +1000 Subject: [PATCH] Format message details to show secondary pubkey properly --- js/models/messages.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/models/messages.js b/js/models/messages.js index 8f91658a8..900cda902 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -912,6 +912,7 @@ // that contact. Otherwise, it will be a standalone entry. const errors = _.reject(allErrors, error => Boolean(error.number)); const errorsGroupedById = _.groupBy(allErrors, 'number'); + const primaryDevicePubKey = this.get('conversationId'); const finalContacts = (phoneNumbers || []).map(id => { const errorsForContact = errorsGroupedById[id]; const isOutgoingKeyError = Boolean( @@ -921,12 +922,20 @@ storage.get('unidentifiedDeliveryIndicators') && this.isUnidentifiedDelivery(id, unidentifiedLookup); + const isPrimaryDevice = id === primaryDevicePubKey; + + const contact = this.findAndFormatContact(id); + const profileName = isPrimaryDevice + ? contact.profileName + : `${contact.profileName} (Secondary Device)`; return { - ...this.findAndFormatContact(id), + ...contact, status: this.getStatus(id), errors: errorsForContact, isOutgoingKeyError, isUnidentifiedDelivery, + isPrimaryDevice, + profileName, onSendAnyway: () => this.trigger('force-send', { contact: this.findContact(id), @@ -941,7 +950,8 @@ // first; otherwise it's alphabetical const sortedContacts = _.sortBy( finalContacts, - contact => `${contact.errors ? '0' : '1'}${contact.title}` + contact => + `${contact.isPrimaryDevice ? '0' : '1'}${contact.phoneNumber}` ); return {