mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
handle SYNC messages
This commit is contained in:
parent
b0122b6ce6
commit
0122fb8603
1 changed files with 14 additions and 1 deletions
|
@ -1012,6 +1012,8 @@ MessageReceiver.prototype.extend({
|
|||
throw e;
|
||||
}
|
||||
},
|
||||
// handle a SYNC message for a message
|
||||
// sent by another device
|
||||
handleSentMessage(envelope, sentContainer, msg) {
|
||||
const {
|
||||
destination,
|
||||
|
@ -1029,9 +1031,10 @@ MessageReceiver.prototype.extend({
|
|||
this.processDecrypted(envelope, msg).then(message => {
|
||||
const groupId = message.group && message.group.id;
|
||||
const isBlocked = this.isGroupBlocked(groupId);
|
||||
const primaryDevicePubKey = window.storage.get('primaryDevicePubKey');
|
||||
const isMe =
|
||||
envelope.source === textsecure.storage.user.getNumber() ||
|
||||
envelope.source === window.storage.get('primaryDevicePubKey');
|
||||
envelope.source === primaryDevicePubKey;
|
||||
const isLeavingGroup = Boolean(
|
||||
message.group &&
|
||||
message.group.type === textsecure.protobuf.GroupContext.Type.QUIT
|
||||
|
@ -1046,6 +1049,16 @@ MessageReceiver.prototype.extend({
|
|||
return this.removeFromCache(envelope);
|
||||
}
|
||||
|
||||
// handle profileKey and avatar updates
|
||||
if (envelope.source === primaryDevicePubKey) {
|
||||
const { profileKey, profile } = message;
|
||||
const primaryConversation = ConversationController.get(
|
||||
primaryDevicePubKey
|
||||
);
|
||||
//
|
||||
this.updateProfile(primaryConversation, profile, profileKey);
|
||||
}
|
||||
|
||||
const ev = new Event('sent');
|
||||
ev.confirm = this.removeFromCache.bind(this, envelope);
|
||||
ev.data = {
|
||||
|
|
Loading…
Reference in a new issue