whatsapp-web.js 1.30.1-alpha.0 → 1.30.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/util/Injected/Utils.js +8 -10
package/package.json
CHANGED
|
@@ -48,9 +48,7 @@ exports.LoadUtils = () => {
|
|
|
48
48
|
if (options.quotedMessageId) {
|
|
49
49
|
let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
|
|
50
50
|
!quotedMessage && (quotedMessage = (await window.Store.Msg.getMessagesById([options.quotedMessageId]))?.messages?.[0]);
|
|
51
|
-
|
|
52
|
-
if (quotedMessage['messages']?.length == 1) {
|
|
53
|
-
quotedMessage = quotedMessage['messages'][0];
|
|
51
|
+
if (quotedMessage) {
|
|
54
52
|
|
|
55
53
|
const canReply = window.Store.ReplyUtils
|
|
56
54
|
? window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe())
|
|
@@ -558,8 +556,8 @@ exports.LoadUtils = () => {
|
|
|
558
556
|
const chatWid = window.Store.WidFactory.createWid(chat.id._serialized);
|
|
559
557
|
await window.Store.GroupMetadata.update(chatWid);
|
|
560
558
|
chat.groupMetadata.participants._models
|
|
561
|
-
.filter(x => x.id
|
|
562
|
-
.forEach(x =>
|
|
559
|
+
.filter(x => x.id?._serialized?.endsWith('@lid'))
|
|
560
|
+
.forEach(x => x.contact?.phoneNumber && (x.id = x.contact.phoneNumber));
|
|
563
561
|
model.groupMetadata = chat.groupMetadata.serialize();
|
|
564
562
|
model.isReadOnly = chat.groupMetadata.announce;
|
|
565
563
|
}
|
|
@@ -845,19 +843,19 @@ exports.LoadUtils = () => {
|
|
|
845
843
|
});
|
|
846
844
|
};
|
|
847
845
|
|
|
848
|
-
window.WWebJS.setPicture = async (
|
|
846
|
+
window.WWebJS.setPicture = async (chatId, media) => {
|
|
849
847
|
const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 });
|
|
850
848
|
const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 });
|
|
851
849
|
|
|
852
|
-
const chatWid = window.Store.WidFactory.createWid(
|
|
850
|
+
const chatWid = window.Store.WidFactory.createWid(chatId);
|
|
853
851
|
try {
|
|
854
|
-
const collection = window.Store.ProfilePicThumb.get(
|
|
855
|
-
if (!collection
|
|
852
|
+
const collection = window.Store.ProfilePicThumb.get(chatId) || await window.Store.ProfilePicThumb.find(chatId);
|
|
853
|
+
if (!collection?.canSet()) return false;
|
|
856
854
|
|
|
857
855
|
const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic);
|
|
858
856
|
return res ? res.status === 200 : false;
|
|
859
857
|
} catch (err) {
|
|
860
|
-
if(err.name === 'ServerStatusCodeError') return false;
|
|
858
|
+
if (err.name === 'ServerStatusCodeError') return false;
|
|
861
859
|
throw err;
|
|
862
860
|
}
|
|
863
861
|
};
|