nu7hatch / gmail

A Rubyesque interface to Gmail, with all the tools you'll need.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Labels can be nested

kingdonb opened this issue · comments

I have been using the gmail gem to help target clean up of my inbox labels and old mail, and I noticed that the only labels with slashes are the labels that start with [Gmail] -- eg. the built-in labels "Sent Mail" "Important" "All Mail"...

This means that two kinds of labels are not shown in my gmail.labels.all.map(&:to_s):

  1. Labels that are nested (eg. create a label, "nest label under")
  2. Labels that actually have slashes in their names (these are top-level IMAP folders but they have a slash in their name. Sometimes Gmail transposes them into dashes for namespace consistency.)

I will try to figure out why and submit a pull request for this later.

These labels with slashes in the name can be accessed (as in gmail.label('ops/cati-error').emails.count to get the number of mails in a top-level label called "ops/cati-error", or "services/client" to get a label called "client" that is nested in a label called "services") but they cannot be enumerated (as in gmail.labels.all)

Your code at least mentions subfolders, so I guess it's possible that something is different now and it worked once before... I'll go looking for a spec to see how it should work.

I also get crash errors trying to count up the messages in "[Gmail]" which shows up in the list of labels but is apparently not a valid label. Same goes for all of the other faux-top-labels like "ops". The label shows up in the list even though it does not exist... maybe I just shouldn't be creating labels with slashes in the name, there doesn't seem to be a way to disambiguate them here.

But "services" is a real label with real nested labels and the children don't show up in gmail.labels.all

I've merged in PR #82 to master which may have fixed this. Please give it a look and re-open if needed. Closing issue for now.

Looks fixed to me, at least just looking superficially.

This issue was moved to gmailgem/gmail#99