From b0122b6ce64859dee866ff3bebacf9836862eef3 Mon Sep 17 00:00:00 2001
From: sachaaaaa <sacha@loki.network>
Date: Fri, 29 Nov 2019 15:04:33 +1100
Subject: [PATCH] Ensure the primary profile is used on secondary devices

---
 libtextsecure/sendmessage.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js
index be5be6c97..b2b23d2ea 100644
--- a/libtextsecure/sendmessage.js
+++ b/libtextsecure/sendmessage.js
@@ -924,7 +924,9 @@ MessageSender.prototype = {
 
   getOurProfile() {
     try {
-      const ourNumber = textsecure.storage.user.getNumber();
+      // Secondary devices have their profile stored
+      // in their primary device's conversation
+      const ourNumber = window.storage.get('primaryDevicePubKey');
       const conversation = window.ConversationController.get(ourNumber);
       return conversation.getLokiProfile();
     } catch (e) {