gmail.js: gmail.get.selected_emails_data() returns wrong emails

I recently noticed when gmail.get.selected_emails_data() is called (and emails are selected) the wrong emails are returned. When viewing the “Primary” inbox tab, it seems to be returning emails from either “Social” or “Promotions” of the same index number.

Tried to debug a little and it seems gmail.helper.get.visible_emails_pre() is returning this URL:

https://mail.google.com/mail/u/0/?ui=2&ik=b92f69409f&rid=undefined&view=tl&num=120&rt=1&start=NaN&sstart=NaN&search=inbox

Requests to this URL seems to be returning emails from the “Social” and “Promotions” tabs.

Could the rid=undefined and start=NaN&sstart=NaN be causing the problem? Let me know what info you need from me to help resolve the issue. Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @josteink, sorry for not getting back to you. I finally had some time to get back to the project that uses this. I tested your fix and unfortunately it does not work for me. It works fine for “@gmail.com” addresses, but not my enterprise Gmail account with a custom domain name.

Using “search=mbox” works for both my “@gmail.com” account and enterprise account. I’ll see if I can get some of my beta testers to give me feedback on this and get a larger sample size.

Thanks for your help on this.

mbox is a unix plain-text file-format for local mail-agents like pine and mutt to organize email.

It’s an interesting theory, but I’m absolutely positive that it is not related to anything happening in the Gmail web front-end.

@scottwrobinson: Sorry about the hold up. If you’re still around…

Based on @Banjerr’s PR you linked to, the comment says:

replacing query param “mbox” (for enterprise gmail account, apparently) with “inbox”

If we can determine whether we are a enterprise/apps-account or regular gmail account, we should use that to determine the best value.

It seems, we should use “inbox” for enterprise accounts and “mbox” for regular gmail accounts.

Could you bother preparing a PR with those changes, and I will do some testing on my end. if everything works here for me too, I’d be happy to merge.

(And if it causes regressions, we’ll just take it from there)