Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In memory store: normalize user when asserting message list to update messages #49

Merged
merged 5 commits into from
May 18, 2023

Conversation

dudagervasio
Copy link
Contributor

I was having some problem with message status update (4 - read).

The remotejid from update was with "device number" inside, and the stored one was normalized, so it could not be found: "got update for non-existent message".

This solved the problem.

Sorry my poor english ;)

@dudagervasio
Copy link
Contributor Author

One thing happens too! And maybe its because of this, that is not normalized yet.

I have received a status = 4 from '9999999999:DEVICE@s.whatsapp.net' (with device number). I was read with WA Web.

And then, 3s later i received a status = 3 from '9999999999@s.whatsapp.net' without device (maybe from the cellphone)

Maybe some adittional check must be done when updating the status! And update just if is biger than the actual.

@dudagervasio
Copy link
Contributor Author

baileys-message update

Problem i mentioned

@potkek
Copy link

potkek commented May 7, 2023

I have not tested your specific case yet but you may be right.

However bro there is one thing regarding code style that you could improve on, in Baileys we don't do function( parameter ) but rather function(parameter). You've also put a lot of line breaks to almost every line which makes the code blocks longer. They can make sense in some places but separating each line destroys the purpose.

Also, have you checked what happens in the status stored newer then update case? You do delete update.status;. Is there any other information in the update object in that case or would it be better to do an early return (or in the case a continue) to skip execution for this update and move on to the next item in the array?

@dudagervasio
Copy link
Contributor Author

@potkek thanks for the code style tips! I made a new commit for it.

I am fresh new in Baileys, i have meet the lib one week before Adi received the C&D... that is why i prefered just delete the status, because if there is other information togheter it will be assigned, and if it does not have, no problem, an empty object wil be assigned, with almost zero cost in performance (i think)

It is my first PR in Baileys and ever ;) Sorry, i am learning how it works :D I will follow your instructions!

@edgardmessias edgardmessias enabled auto-merge (squash) May 14, 2023 02:36
@edgardmessias edgardmessias merged commit 7b4abcd into WhiskeySockets:master May 18, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants