enable profile sharing after becoming friends for private messages

pull/661/head
sachaaaaa 6 years ago
parent 7c52a1d038
commit 5b7baaf357

@ -87,6 +87,7 @@
groupAdmins: [], groupAdmins: [],
isKickedFromGroup: false, isKickedFromGroup: false,
isOnline: false, isOnline: false,
profileSharing: false,
}; };
}, },
@ -846,14 +847,18 @@
} }
if (this.get('friendRequestStatus') !== newStatus) { if (this.get('friendRequestStatus') !== newStatus) {
this.set({ friendRequestStatus: newStatus }); this.set({ friendRequestStatus: newStatus });
if (newStatus === FriendRequestStatusEnum.friends) {
if (!blockSync) {
// Sync contact
this.wrapSend(textsecure.messaging.sendContactSyncMessage(this));
}
// Only enable sending profileKey after becoming friends
this.set({ profileSharing: true });
}
await window.Signal.Data.updateConversation(this.id, this.attributes, { await window.Signal.Data.updateConversation(this.id, this.attributes, {
Conversation: Whisper.Conversation, Conversation: Whisper.Conversation,
}); });
await this.updateTextInputState(); await this.updateTextInputState();
if (!blockSync && newStatus === FriendRequestStatusEnum.friends) {
// Sync contact
this.wrapSend(textsecure.messaging.sendContactSyncMessage(this));
}
} }
}, },
async updateGroupAdmins(groupAdmins) { async updateGroupAdmins(groupAdmins) {
@ -1493,6 +1498,11 @@
FriendRequestStatusEnum.pendingSend FriendRequestStatusEnum.pendingSend
); );
// Always share our profileKey in the friend request
// This will get added automatically after the FR
// is accepted, via the profileSharing flag
profileKey = storage.get('profileKey');
// Send the friend request! // Send the friend request!
messageWithSchema = await upgradeMessageSchema({ messageWithSchema = await upgradeMessageSchema({
type: 'friend-request', type: 'friend-request',

Loading…
Cancel
Save