Skip to content

Commit

Permalink
fix: 🐛 set all user to friend
Browse files Browse the repository at this point in the history
  • Loading branch information
hcfw007 committed Jul 20, 2023
1 parent 8d83e56 commit e36dba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/helper/pure-function/contact-raw-payload-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function parserContactRawPayload (contactPayload: WhatsAppContactPayload,

const number = contactPayload.number || contactPayload.id.user

const isFriend = contactPayload.isMyContact && contactPayload.isUser
const isFriend = contactPayload.isUser
return {
avatar: contactPayload.avatar,
friend: isFriend,
Expand Down
8 changes: 4 additions & 4 deletions src/whatsapp/event-handler/message-event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export default class MessageEventHandler extends WhatsAppBase {

const contactId = message.from
if (contactId && isContactId(contactId)) {
const contactIds = await cacheManager.getContactIdList()
const notFriend = !contactIds.find(c => c === contactId)
const contact = await cacheManager.getContactOrRoomRawPayload(contactId)
const notFriend = !contact?.isMyContact
if (notFriend) {
this.emit('friendship', { friendshipId: messageId })
}
Expand Down Expand Up @@ -131,8 +131,8 @@ export default class MessageEventHandler extends WhatsAppBase {
requestPool.resolveRequest(messageId)
const receiverId = message.to
if (receiverId && isContactId(receiverId)) {
const contactIds = await cacheManager.getContactIdList()
const notFriend = !contactIds.find(c => c === receiverId)
const contact = await cacheManager.getContactOrRoomRawPayload(receiverId)
const notFriend = !contact?.isMyContact
if (notFriend) {
this.emit('friendship', { friendshipId: messageId })
}
Expand Down

0 comments on commit e36dba3

Please sign in to comment.