fix: message replies compatible with WhatsApp Web v2.2241.6 (#1765)
* fix message replies * fix up some tests
This commit is contained in:
parent
7bb7f13f07
commit
9981723505
3 changed files with 15 additions and 5 deletions
|
|
@ -50,6 +50,7 @@ exports.ExposeStore = (moduleRaidStr) => {
|
||||||
window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg;
|
window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg;
|
||||||
window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0];
|
window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0];
|
||||||
window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0];
|
window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0];
|
||||||
|
window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0];
|
||||||
window.Store.StickerTools = {
|
window.Store.StickerTools = {
|
||||||
...window.mR.findModule('toWebpSticker')[0],
|
...window.mR.findModule('toWebpSticker')[0],
|
||||||
...window.mR.findModule('addWebpMetadata')[0]
|
...window.mR.findModule('addWebpMetadata')[0]
|
||||||
|
|
@ -116,7 +117,13 @@ exports.LoadUtils = () => {
|
||||||
let quotedMsgOptions = {};
|
let quotedMsgOptions = {};
|
||||||
if (options.quotedMessageId) {
|
if (options.quotedMessageId) {
|
||||||
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
|
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
|
||||||
if (quotedMessage.canReply()) {
|
|
||||||
|
// TODO remove .canReply() once all clients are updated to >= v2.2241.6
|
||||||
|
const canReply = window.Store.ReplyUtils ?
|
||||||
|
window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
|
||||||
|
quotedMessage.canReply();
|
||||||
|
|
||||||
|
if (canReply) {
|
||||||
quotedMsgOptions = quotedMessage.msgContextInfo(chat);
|
quotedMsgOptions = quotedMessage.msgContextInfo(chat);
|
||||||
}
|
}
|
||||||
delete options.quotedMessageId;
|
delete options.quotedMessageId;
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ describe('Client', function() {
|
||||||
await helper.sleep(20000);
|
await helper.sleep(20000);
|
||||||
|
|
||||||
expect(callback.called).to.equal(true);
|
expect(callback.called).to.equal(true);
|
||||||
expect(callback.args[0][0]).to.have.lengthOf(152);
|
expect(callback.args[0][0]).to.have.length.greaterThanOrEqual(152);
|
||||||
|
|
||||||
await client.destroy();
|
await client.destroy();
|
||||||
});
|
});
|
||||||
|
|
@ -224,7 +224,7 @@ describe('Client', function() {
|
||||||
|
|
||||||
expect(authFailCallback.called).to.equal(true);
|
expect(authFailCallback.called).to.equal(true);
|
||||||
expect(qrCallback.called).to.equal(true);
|
expect(qrCallback.called).to.equal(true);
|
||||||
expect(qrCallback.args[0][0]).to.have.lengthOf(152);
|
expect(qrCallback.args[0][0]).to.have.length.greaterThanOrEqual(152);
|
||||||
|
|
||||||
await client.destroy();
|
await client.destroy();
|
||||||
});
|
});
|
||||||
|
|
@ -346,7 +346,6 @@ describe('Client', function() {
|
||||||
'UserConstructor',
|
'UserConstructor',
|
||||||
'VCard',
|
'VCard',
|
||||||
'Validators',
|
'Validators',
|
||||||
'Wap',
|
|
||||||
'WidFactory',
|
'WidFactory',
|
||||||
'findCommonGroups',
|
'findCommonGroups',
|
||||||
'sendReactionToMsg',
|
'sendReactionToMsg',
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ describe('Message', function () {
|
||||||
expect(message.isStarred).to.equal(false);
|
expect(message.isStarred).to.equal(false);
|
||||||
await message.star();
|
await message.star();
|
||||||
|
|
||||||
|
await helper.sleep(1000);
|
||||||
|
|
||||||
// reload and check
|
// reload and check
|
||||||
await message.reload();
|
await message.reload();
|
||||||
expect(message.isStarred).to.equal(true);
|
expect(message.isStarred).to.equal(true);
|
||||||
|
|
@ -75,6 +77,8 @@ describe('Message', function () {
|
||||||
expect(message.isStarred).to.equal(true);
|
expect(message.isStarred).to.equal(true);
|
||||||
await message.unstar();
|
await message.unstar();
|
||||||
|
|
||||||
|
await helper.sleep(1000);
|
||||||
|
|
||||||
// reload and check
|
// reload and check
|
||||||
await message.reload();
|
await message.reload();
|
||||||
expect(message.isStarred).to.equal(false);
|
expect(message.isStarred).to.equal(false);
|
||||||
|
|
@ -85,7 +89,7 @@ describe('Message', function () {
|
||||||
it('can delete a message for me', async function () {
|
it('can delete a message for me', async function () {
|
||||||
await message.delete();
|
await message.delete();
|
||||||
|
|
||||||
await helper.sleep(1000);
|
await helper.sleep(5000);
|
||||||
expect(await message.reload()).to.equal(null);
|
expect(await message.reload()).to.equal(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue