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

gmail.get.visible_emails() returning wrong result in "Primary" tab #320

Closed
Fatal-Errol opened this issue Oct 15, 2016 · 12 comments
Closed
Labels

Comments

@Fatal-Errol
Copy link

Calling gmail.get.visible_emails() when in the primary tab returns 350 items and ignores the pagination set so moving from page to page always returns the same result. On top of that, the 350 items are a mixture of contents from the other tab ('social' etc), 70 items from primary, 70 from social etc. The other tabs and pages are working fine.

Thanks

@Fatal-Errol
Copy link
Author

I updated to the latest updates because the changelog says the visible_emails was fixed. Tried it but it still the same plus it generates an exception when you are in a different page.

@josteink
Copy link
Collaborator

Thanks for registering an issue. Could you provide more details about the errors you are encountering? Basically a stack-trace or something, which makes it a bit easier to narrow down the error?

@avzabr: I think you were the last one to meddle around these parts? Any ideas on what's going on here?

@josteink
Copy link
Collaborator

Without more data it's hard dig deeper into this one. With that said...

Tried it but it still the same, plus it generates an exception when you are in a different page.

I did just find a parsing error which has been introduced recently. I'm guessing this could be related to that error?

Can you update to latest and see if that fixes the exceptions for you?

@josteink
Copy link
Collaborator

This PR attempts to solve this issue: #344

@avzabr
Copy link
Contributor

avzabr commented Nov 28, 2016

@josteink @Fatal-Errol
Unfortunately i don't know the cause here as well.
Internally for my project i am using the updated version of api.helper.get.visible_emails_pre function. It works well for me for all tabs, pagination, corporate and default accounts. But i don't want to submit a pull request to the original gmail.js repo until this change is verified completely ( I closed the #344 until its tested).

Changes are available for review at this pull request (my fork of gmail.js):
https://github.com/avzabr/gmail.js/pull/2/files

@Fatal-Errol
You can try to checkout the version of gmail.js from my fork:
https://github.com/avzabr/gmail.js/tree/Issue320

Please let us know if this solves the issue for you.

@josteink
Copy link
Collaborator

josteink commented Nov 29, 2016

Working on a feature-branch for this issue, I've encountered and error in api.helper.get.visible_email_post too:

`VM294219:3 Uncaught SyntaxError: Unexpected token <
    at new Function (<anonymous>)
    at Object.Gmail_.api.helper.get.visible_emails_post (chrome-extension://kdppikmlfhaomdcjiaepkemdlpojldoo/dist/gmailExtensionLoader.js:1661:20)
    at Object.Gmail_.api.get.visible_emails (chrome-extension://kdppikmlfhaomdcjiaepkemdlpojldoo/dist/gmailExtensionLoader.js:1699:37)
    at <anonymous>:1:11Gmail_.api.helper.get.visible_emails_post @ gmail.js:1660Gmail_.api.get.visible_emails @ gmail.js:1698(anonymous function) @ VM294218:1
gmail.get.visible_emails();

From what I can tell, the error is caused by the server-response being a HTML-formatted error-message, meaning we're probably not generating a good XHR-request in the first place.

Based on that I'll see if I can find out what goes wrong and where.

@josteink
Copy link
Collaborator

Upon further testing, this only happens when I'm on the wrong page. Should we catch this error and suggest a resolution?

@avzabr
Copy link
Contributor

avzabr commented Nov 29, 2016

@josteink What do you mean by a wrong page?

@josteink
Copy link
Collaborator

josteink commented Nov 29, 2016

If I were looking at a specific email-thread and calling api.get.visible_emails() it would fail. This function evidently seems designed to work when you're looking at list of emails (like a page in your inbox). And that's absolutely fair enough. That's OK.

But if/when things fail (and it might be due to API misuse), we might want to make it more explicit what scenarios are supported. Agreed?

@avzabr
Copy link
Contributor

avzabr commented Nov 29, 2016

Yep, sounds correct. But it looks like the fix is for a different issue, not related to this thread: incorrect results set at primary tab returned from gmail.get.visible_emails() ?

@josteink
Copy link
Collaborator

I tried opening a "primary" inbox and from what I could tell I was getting the correct results there, with no exceptions.

I must admit on this test-account I don't have enough email (and even less priority email ) to generate multiple-pages though...

@josteink
Copy link
Collaborator

Since I haven't heard anything new on this issue, I'm closing it.

Please re-open it if you still have an issue you need resolved.

@josteink josteink added the bug label Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants