gmail.js icon indicating copy to clipboard operation
gmail.js copied to clipboard

Update get.unread_inbox_emails to get a count

Open ezl opened this issue 6 years ago • 1 comments

Problem

api.get.unread_inbox_emails is returning 0, when there are unread inbox emails.

(probably the same thing happening for all api.get.unread_emails() keys)

Detail

My left navigation looks like this:

The api.get.unread_emails() method is looking for a semicolon in the title:

 573             if(dom[0].title.indexOf("(") !== -1) {
 574                 return parseInt(dom[0].title.split(":")[0].replace(/[^0-9]/g, ""));
 575             }

My title doesn't have the email count or a semicolon in it:

Working replacement for my Gmail instance

parseInt(dom[0].attributes['aria-label'].value.replace(/[^0-9]/g, ""));
// instead of looking for the count in the title, look in the aria-label

ezl avatar Feb 07 '19 20:02 ezl

That looks reasonable enough. Could you create a PR for that?

josteink avatar Feb 08 '19 10:02 josteink