Fix contact status in createContactSyncProtoMessage

pull/609/head
sachaaaaa 6 years ago
parent 5529deb019
commit 843c5b5ebc

@ -120,30 +120,32 @@
{ ConversationCollection: Whisper.ConversationCollection } { ConversationCollection: Whisper.ConversationCollection }
); );
// Extract required contacts information out of conversations // Extract required contacts information out of conversations
const rawContacts = conversations.map(conversation => { const rawContacts = await Promise.all(
const profile = conversation.getLokiProfile(); conversations.map(async conversation => {
const number = conversation.getNumber(); const profile = conversation.getLokiProfile();
const name = profile const number = conversation.getNumber();
? profile.displayName const name = profile
: conversation.getProfileName(); ? profile.displayName
const status = conversation.safeGetVerified(); : conversation.getProfileName();
const protoState = textsecure.storage.protocol.convertVerifiedStatusToProtoState( const status = await conversation.safeGetVerified();
status const protoState = textsecure.storage.protocol.convertVerifiedStatusToProtoState(
); status
const verified = new textsecure.protobuf.Verified({ );
state: protoState, const verified = new textsecure.protobuf.Verified({
destination: number, state: protoState,
identityKey: StringView.hexToArrayBuffer(number), destination: number,
}); identityKey: StringView.hexToArrayBuffer(number),
return { });
name, return {
verified, name,
number, verified,
nickname: conversation.getNickname(), number,
blocked: conversation.isBlocked(), nickname: conversation.getNickname(),
expireTimer: conversation.get('expireTimer'), blocked: conversation.isBlocked(),
}; expireTimer: conversation.get('expireTimer'),
}); };
})
);
// Convert raw contacts to an array of buffers // Convert raw contacts to an array of buffers
const contactDetails = rawContacts const contactDetails = rawContacts
.filter(x => x.number !== textsecure.storage.user.getNumber()) .filter(x => x.number !== textsecure.storage.user.getNumber())

Loading…
Cancel
Save