Fix: Cannot read properties of undefined (reading 'features') // original: (#1407) (#1410)

* Fix: Cannot read properties of undefined (reading 'features') (#1407)

* Fix: Cannot read properties of undefined (reading 'features')

Find MD backend without features

* Fix for tests

* Update Client.js

* Update LegacySessionAuth.js

Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
This commit is contained in:
Rajeh Taher
2022-04-22 00:15:00 +03:00
committed by GitHub
parent 3a2acf71c2
commit 5e2e9dd139
3 changed files with 7 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ exports.ExposeStore = (moduleRaidStr) => {
window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK;
window.Store.MDBackend = window.mR.findModule('isMDBackend')[0].isMDBackend();
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
@@ -159,7 +159,7 @@ exports.LoadUtils = () => {
delete options.linkPreview;
// Not supported yet by WhatsApp Web on MD
if(!window.Store.Features.features.MD_BACKEND) {
if(!window.Store.MDBackend) {
const link = window.Store.Validators.findLink(content);
if (link) {
const preview = await window.Store.Wap.queryLinkPreview(link.url);
@@ -211,7 +211,7 @@ exports.LoadUtils = () => {
}
const meUser = window.Store.User.getMaybeMeUser();
const isMD = window.Store.Features.features.MD_BACKEND;
const isMD = window.Store.MDBackend;
const newMsgId = new window.Store.MsgKey({
from: meUser,
@@ -512,7 +512,7 @@ exports.LoadUtils = () => {
};
window.WWebJS.sendChatstate = async (state, chatId) => {
if (window.Store.Features.features.MD_BACKEND) {
if (window.Store.MDBackend) {
chatId = window.Store.WidFactory.createWid(chatId);
}
switch (state) {