From daf5da09c651d3e2993e3460bfa38aff34906365 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 3 Dec 2019 16:27:40 +1100 Subject: [PATCH] Fix minor profile picture bugs. --- libtextsecure/message_receiver.js | 5 +++-- libtextsecure/sendmessage.js | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 7092f2ab6..92b4def8c 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -1059,8 +1059,9 @@ MessageReceiver.prototype.extend({ const primaryConversation = ConversationController.get( primaryDevicePubKey ); - // - this.updateProfile(primaryConversation, profile, profileKey); + if (profile) { + this.updateProfile(primaryConversation, profile, profileKey); + } } const ev = new Event('sent'); diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index b2b23d2ea..329d12fda 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -144,17 +144,17 @@ Message.prototype = { proto.profileKey = this.profileKey; } - // Only send the display name for now. - // In the future we might want to extend this to send other things. - if (this.profile && this.profile.displayName) { + // Set the loki profile + if (this.profile) { const profile = new textsecure.protobuf.DataMessage.LokiProfile(); - profile.displayName = this.profile.displayName; + if (this.profile.displayName) { + profile.displayName = this.profile.displayName; + } const conversation = window.ConversationController.get( textsecure.storage.user.getNumber() ); const avatarPointer = conversation.get('avatarPointer'); - if (avatarPointer) { profile.avatar = avatarPointer; }