fix: GroupChat.setPicture (#3593)
* fix: find collection if not in cache * style: use camelcase
This commit is contained in:
parent
e1b0cdc852
commit
d2fe324e5b
1 changed files with 5 additions and 5 deletions
|
|
@ -843,14 +843,14 @@ exports.LoadUtils = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
window.WWebJS.setPicture = async (chatid, media) => {
|
window.WWebJS.setPicture = async (chatId, media) => {
|
||||||
const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 });
|
const thumbnail = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 96 });
|
||||||
const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 });
|
const profilePic = await window.WWebJS.cropAndResizeImage(media, { asDataUrl: true, mimetype: 'image/jpeg', size: 640 });
|
||||||
|
|
||||||
const chatWid = window.Store.WidFactory.createWid(chatid);
|
const chatWid = window.Store.WidFactory.createWid(chatId);
|
||||||
try {
|
try {
|
||||||
const collection = window.Store.ProfilePicThumb.get(chatid);
|
const collection = window.Store.ProfilePicThumb.get(chatId) || await window.Store.ProfilePicThumb.find(chatId);
|
||||||
if (!collection.canSet()) return;
|
if (!collection?.canSet()) return false;
|
||||||
|
|
||||||
const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic);
|
const res = await window.Store.GroupUtils.sendSetPicture(chatWid, thumbnail, profilePic);
|
||||||
return res ? res.status === 200 : false;
|
return res ? res.status === 200 : false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue