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

Implement minimal createMailbox CREATE feature. #43

Merged
merged 1 commit into from
Nov 27, 2014

Conversation

asutherland
Copy link
Contributor

Since folder management is not entirely trivial given the interaction of
namespaces and delimiters, it could make sense to also support some type
of slightly higher level API as well.

This could entail having listNamespaces and listMailboxes called together
and retain their results, which starts to get tricky. So for now I figured
I would just implement the low level CREATE binding.

(In gaia-email-libs-and-more we've got some existing logic which I've now cleaned up. I've also added a bunch of unit tests in a pending pull request. I can try to upstream that once we reach consensus.)

Since folder management is not entirely trivial given the interaction of
namespaces and delimiters, it could make sense to also support some type
of slightly higher level API as well.

This could entail having listNamespaces and listMailboxes called together
and retain their results, which starts to get tricky.  So for now I figured
I would just implement the low level CREATE binding.
asutherland added a commit to asutherland/gaia-email-libs-and-more that referenced this pull request Nov 26, 2014
When we moved to email.js, createFolder was completely broken.
I've done the following:

- Implemented a createMailbox function in browserbox:
  emailjs/emailjs-imap-client#43

- Cleaned up our createFolder job.  This is reasonably straightforward.  The
  big change is we no longer perform a "LIST" after the fact to see what name
  transforms might have happened.  I added a comment explaining this change.
  It's probably important to note that the original choice of doing that I
  think was primarily a cop-out on my part from trying to understand the folder
  naming rules and having had the goal of createFolder being a comprehensive
  feature we'd surface to users.

- Fixed a testing infrastructure oversight.  expect_runOp had explicit support
  to expect a specific error result for runOp_end.  Unfortunately due to an
  asymmetry with other log types (ex: event) and the "error" argument having
  a value of false, we were not actually checking the value!  For the purposes
  of minimalism, I updated the log definitions rather than log.js.  This
  required minimal changes to test_disaster_recovery.js and to js/jobmixins.js
  for downloadBodyReps to make sure the error code was explicitly null rather
  than undefined.

- I cleaned up comments as I went.

- mail-fakeservers enhancements that get pulled in please see the commit comment
  there: mozilla-b2g/mail-fakeservers#28

Testing-wise, we have the following coverage:

- The unit tests I added to browserbox above.  They're pretty simple, but get
  us coverage of utf-7 encoding/decoding verification which we don't test
  in here.

- Added a unit test for the path-generating logic that has pretty good coverage
  (I feel).

- Added a fakeserver-using test that makes sure we create the folders and also
  tests both of the expected exceptional cases: "the folder totally already
  exists and it's known locally, dude", and "the server ALREADYEXISTS on the
  server".  Not explicitly tested is that if the server just outright fails
  that we generate the correct error.  However, I manually verified we do this
  during the process of development because of doing this TDD-style.
asutherland added a commit to asutherland/gaia-email-libs-and-more that referenced this pull request Nov 27, 2014
When we moved to email.js, createFolder was completely broken.
I've done the following:

- Implemented a createMailbox function in browserbox:
  emailjs/emailjs-imap-client#43

- Cleaned up our createFolder job.  This is reasonably straightforward.  The
  big change is we no longer perform a "LIST" after the fact to see what name
  transforms might have happened.  I added a comment explaining this change.
  It's probably important to note that the original choice of doing that I
  think was primarily a cop-out on my part from trying to understand the folder
  naming rules and having had the goal of createFolder being a comprehensive
  feature we'd surface to users.

- Fixed a testing infrastructure oversight.  expect_runOp had explicit support
  to expect a specific error result for runOp_end.  Unfortunately due to an
  asymmetry with other log types (ex: event) and the "error" argument having
  a value of false, we were not actually checking the value!  For the purposes
  of minimalism, I updated the log definitions rather than log.js.  This
  required minimal changes to test_disaster_recovery.js and to js/jobmixins.js
  for downloadBodyReps to make sure the error code was explicitly null rather
  than undefined.

- I cleaned up comments as I went.

- mail-fakeservers enhancements that get pulled in please see the commit comment
  there: mozilla-b2g/mail-fakeservers#28

Testing-wise, we have the following coverage:

- The unit tests I added to browserbox above.  They're pretty simple, but get
  us coverage of utf-7 encoding/decoding verification which we don't test
  in here.

- Added a unit test for the path-generating logic that has pretty good coverage
  (I feel).

- Added a fakeserver-using test that makes sure we create the folders and also
  tests both of the expected exceptional cases: "the folder totally already
  exists and it's known locally, dude", and "the server ALREADYEXISTS on the
  server".  Not explicitly tested is that if the server just outright fails
  that we generate the correct error.  However, I manually verified we do this
  during the process of development because of doing this TDD-style.
@andris9
Copy link
Member

andris9 commented Nov 27, 2014

Thanks! Basically this is exactly what I had on mind. In the future I might just edit the method to accept arrays or some kind of structured representation of the mailbox path, so the user would not have to worry about folder separators and such but right now this is more than good enough.

andris9 added a commit that referenced this pull request Nov 27, 2014
Implement minimal createMailbox CREATE feature.
@andris9 andris9 merged commit 5cbc477 into emailjs:master Nov 27, 2014
@asutherland asutherland deleted the create-mailbox branch November 29, 2014 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants