lint: 0 warnings left

This commit is contained in:
Rajeh Taher
2024-10-14 05:15:10 +03:00
parent 61a0ff3178
commit 18ac07df8e
32 changed files with 652 additions and 1006 deletions

View File

@@ -999,15 +999,13 @@ export const makeChatsSocket = (config: SocketConfig) => {
)
}
if(receivedPendingNotifications) {
// if we don't have the app state key
if(receivedPendingNotifications && // if we don't have the app state key
// we keep buffering events until we finally have
// the key and can sync the messages
// todo scrutinize
if(!authState.creds?.myAppStateKeyId) {
ev.buffer()
needToFlushWithAppStateSync = true
}
!authState.creds?.myAppStateKeyId) {
ev.buffer()
needToFlushWithAppStateSync = true
}
})

View File

@@ -342,7 +342,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
break
case 'membership_approval_mode':
const approvalMode: any = getBinaryNodeChild(child, 'group_join')
const approvalMode = getBinaryNodeChild(child, 'group_join')
if(approvalMode) {
msg.messageStubType = WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE
msg.messageStubParameters = [ approvalMode.attrs.state ]
@@ -574,8 +574,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
logger.debug({ participant, sendToAll }, 'forced new session for retry recp')
for(let i = 0; i < msgs.length;i++) {
const msg = msgs[i]
for(const [i, msg] of msgs.entries()) {
if(msg) {
updateSendMessageAgainCount(ids[i], participant)
const msgRelayOpts: MessageRelayOptions = { messageId: ids[i] }
@@ -761,10 +760,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
msg.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT, response]
}
if(msg.message?.protocolMessage?.type === proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER) {
if(node.attrs.sender_pn) {
ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn })
}
if(msg.message?.protocolMessage?.type === proto.Message.ProtocolMessage.Type.SHARE_PHONE_NUMBER && node.attrs.sender_pn) {
ev.emit('chats.phoneNumberShare', { lid: node.attrs.from, jid: node.attrs.sender_pn })
}
try {
@@ -851,7 +848,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
return sendPeerDataOperationMessage(pdoMessage)
}
const requestPlaceholderResend = async(messageKey: WAMessageKey): Promise<'RESOLVED'| string | undefined> => {
const requestPlaceholderResend = async(messageKey: WAMessageKey): Promise<string | undefined> => {
if(!authState.creds.me?.id) {
throw new Boom('Not authenticated')
}

View File

@@ -280,7 +280,7 @@ export const makeMessagesSocket = (config: SocketConfig) => {
}
}
const meJid = jidNormalizedUser(authState.creds.me.id)!
const meJid = jidNormalizedUser(authState.creds.me.id)
const msgId = await relayMessage(meJid, protocolMessage, {
additionalAttributes: {

View File

@@ -76,7 +76,7 @@ export const makeSocket = (config: SocketConfig) => {
url.searchParams.append('ED', authState.creds.routingInfo.toString('base64url'))
}
const ws = config.socket ? config.socket : new WebSocketClient(url, config)
const ws = new WebSocketClient(url, config)
ws.connect()
@@ -327,11 +327,12 @@ export const makeSocket = (config: SocketConfig) => {
const l1 = frame.attrs || {}
const l2 = Array.isArray(frame.content) ? frame.content[0]?.tag : ''
Object.keys(l1).forEach(key => {
for(const key of Object.keys(l1)) {
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]},${l2}`, frame) || anyTriggered
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]}`, frame) || anyTriggered
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},${key}`, frame) || anyTriggered
})
}
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0},,${l2}`, frame) || anyTriggered
anyTriggered = ws.emit(`${DEF_CALLBACK_PREFIX}${l0}`, frame) || anyTriggered