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

patches ext/api.js: parseMsg, _serialized #46

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

idoenk
Copy link

@idoenk idoenk commented Oct 27, 2018

[89de903]
Found error while receiving msg; I think the structure has been changed. cmiiw.

[eba3edb]
I think result item to find should be enough by matching to its _serialized value, instead of comparing the object it self.

Coz:

a = {s: "c.us", u: "foo", _sr: "[email protected]"}, b = {s: "c.us", u: "foo", _sr: "[email protected]"}; a == b;
false
a = {s: "c.us", u: "foo", _sr: "[email protected]"}, b = {s: "c.us", u: "foo", _sr: "[email protected]"}, c = a; a === c;
true
a = {s: "c.us", u: "foo", _sr: "[email protected]"}, b = {s: "c.us", u: "foo", _sr: "[email protected]"}; c = {ca: a, cb: "bar"}; a == c.ca;
true

But, there's no guarantee that chat = msg.__x_from (you have it from handler) is the EXACT same object like you are gonna look in Store.Chat.models..

@idoenk idoenk changed the title Some patch ext/api.js patches ext/api.js: parseMsg, _serialized Oct 27, 2018
…oid keep firing handler; Build chat Object from __x_to due to __x_chat is missing on join via invite-link;
@yotam180
Copy link
Owner

I see... First of all, thank you so much for the PR (and happy Hacktoberfest if that's the reason you're here 🎉)

[89de903]
I do have to look into parseMsgObject. The original use of the method was to provide an object that can be easily serialized into JSON (stripping the Msg object from circular references and non-JSON-serializable types).

Your hotfix here just changes the method's characteristic and not its behaviour. Give me a couple of hours to look at that because:

  1. That method might not be required for the project anymore, then we can get rid of it completely.
  2. If it is required, I want to take a look myself and see how I can fix it, keeping the method's original meaning.

[eba3edb]
Indeed you are right... Might have been changed by Whatsapp, since last time I compared the ids they were strings rather than objects. Given that it has changed, the _serialized property should be the one to be checked against. Thank you very much for pointing that out.


Again, sincerely, thank you for pointing those matters out. I may not have the time today to take a deeper look and run it by myself, but I will get to it as soon as possible.

@nofearOnline If you want to take a look too

@yotam180 yotam180 added the bug label Oct 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants