refactor: remove wwebjs patch
This commit is contained in:
parent
dd886a1fea
commit
1200abd9c8
1 changed files with 0 additions and 26 deletions
26
src/utils.js
26
src/utils.js
|
|
@ -144,32 +144,6 @@ const patchWWebLibrary = async (client) => {
|
|||
filteredChats.map(chat => window.WWebJS.getChatModel(chat))
|
||||
)
|
||||
}
|
||||
|
||||
// hotfix for https://github.com/pedroslopez/whatsapp-web.js/pull/3703
|
||||
window.Store.FindOrCreateChat = window.require('WAWebFindChatAction')
|
||||
window.WWebJS.getChat = async (chatId, { getAsModel = true } = {}) => {
|
||||
const isChannel = /@\w*newsletter\b/.test(chatId)
|
||||
const chatWid = window.Store.WidFactory.createWid(chatId)
|
||||
let chat
|
||||
|
||||
if (isChannel) {
|
||||
try {
|
||||
chat = window.Store.NewsletterCollection.get(chatId)
|
||||
if (!chat) {
|
||||
await window.Store.ChannelUtils.loadNewsletterPreviewChat(chatId)
|
||||
chat = await window.Store.NewsletterCollection.find(chatWid)
|
||||
}
|
||||
} catch (err) {
|
||||
chat = null
|
||||
}
|
||||
} else {
|
||||
chat = window.Store.Chat.get(chatWid) || (await window.Store.FindOrCreateChat.findOrCreateLatestChat(chatWid))?.chat
|
||||
}
|
||||
|
||||
return getAsModel && chat
|
||||
? await window.WWebJS.getChatModel(chat, { isChannel })
|
||||
: chat
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue