Merge branch 'master' into bugfix-multi_vcard

This commit is contained in:
Pedro S. Lopez
2020-11-05 01:55:03 -04:00
committed by GitHub
38 changed files with 1133 additions and 867 deletions

View File

@@ -10,7 +10,7 @@ class ClientInfo extends Base {
constructor(client, data) {
super(client);
if(data) this._patch(data);
if (data) this._patch(data);
}
_patch(data) {
@@ -20,11 +20,17 @@ class ClientInfo extends Base {
*/
this.pushname = data.pushname;
/**
* @type {object}
* @deprecated Use .wid instead
*/
this.me = data.wid;
/**
* Current user ID
* @type {object}
*/
this.me = data.me;
this.wid = data.wid;
/**
* Information about the phone this client is connected to

View File

@@ -28,6 +28,7 @@ exports.ExposeStore = (moduleRaidStr) => {
window.Store.Validators = window.mR.findModule('findLinks')[0];
window.Store.WidFactory = window.mR.findModule('createWid')[0];
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
};
exports.LoadUtils = () => {
@@ -89,7 +90,7 @@ exports.LoadUtils = () => {
vcardFormattedName: contact.formattedName
};
delete options.contactCard;
} else if(options.contactCardList) {
} else if (options.contactCardList) {
let contacts = options.contactCardList.map(c => window.Store.Contact.get(c));
let vcards = contacts.map(c => window.Store.VCard.vcardFromContactModel(c));
vcardOptions = {
@@ -98,21 +99,21 @@ exports.LoadUtils = () => {
body: undefined
};
delete options.contactCardList;
} else if(options.parseVCards && typeof(content) === 'string' && content.startsWith('BEGIN:VCARD')) {
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
delete options.parseVCards;
try {
const parsed = window.Store.VCard.parseVcard(content);
if(parsed) {
if (parsed) {
vcardOptions = {
type: 'vcard',
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
};
}
} catch(_) {
} catch (_) {
// not a vcard
}
}
if (options.linkPreview) {
delete options.linkPreview;
const link = window.Store.Validators.findLink(content);
@@ -125,8 +126,8 @@ exports.LoadUtils = () => {
}
const newMsgId = new window.Store.MsgKey({
from: window.Store.Conn.me,
to: chat.id,
fromMe: true,
remote: chat.id,
id: window.Store.genId(),
});
@@ -135,7 +136,7 @@ exports.LoadUtils = () => {
id: newMsgId,
ack: 0,
body: content,
from: window.Store.Conn.me,
from: window.Store.Conn.wid,
to: chat.id,
local: true,
self: 'out',