include display name in outgoing messages

pull/1201/head
Audric Ackermann 5 years ago
parent 24f86de087
commit c419ff9cd2
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1305,6 +1305,7 @@
});
// FIXME audric add back profileKey
const lokiProfile = this.getOurProfile();
const chatMessage = new libsession.Messages.Outgoing.ChatMessage({
body: messageBody,
timestamp: Date.now(),
@ -1312,6 +1313,7 @@
expireTimer,
preview,
quote,
lokiProfile,
});
// Start handle ChatMessages (attachments/quote/preview/body)
// FIXME AUDRIC handle attachments, quote, preview, profileKey
@ -2554,6 +2556,30 @@
return this.getNumber();
},
/**
* Returns
* displayName: string;
* avatarPointer: string;
* profileKey: Uint8Array;
*/
getOurProfile() {
try {
// Secondary devices have their profile stored
// in their primary device's conversation
const ourNumber = window.storage.get('primaryDevicePubKey');
const ourConversation = window.ConversationController.get(ourNumber);
let profileKey = null;
if (this.get('profileSharing')) {
profileKey = storage.get('profileKey');
}
const avatarPointer = ourConversation.get('avatarPointer');
const { displayName } = ourConversation.getLokiProfile();
return { displayName, avatarPointer, profileKey };
} catch (e) {
window.log.error(`Failed to get our profile: ${e}`);
return null;
}
},
getNumber() {
if (!this.isPrivate()) {

@ -107,6 +107,9 @@ export class ChatMessage extends DataMessage {
}
if (this.profileKey) {
dataMessage.profileKey = this.profileKey;
dataMessage.flags =
// tslint:disable-next-line: no-bitwise
dataMessage.flags | SignalService.DataMessage.Flags.PROFILE_KEY_UPDATE;
}
if (this.quote) {

Loading…
Cancel
Save