[api/tags] Propagate deleting of tags to threads.

Summary:
When a tag is deleted, it needs to be removed from the thread as well.
Fixes T396

Test Plan: Run test which exercises the problem.

Reviewers: emfree

Reviewed By: emfree

Maniphest Tasks: T396

Differential Revision: https://review.inboxapp.com/D421
Fix imports + global var in ./bin/syncback-service
Mark individual messages as read/unread when the unread tag is removed/added.

Summary: Fixes T375.

Test Plan: Unit tests added.

Reviewers: kav-ya

Reviewed By: kav-ya

Maniphest Tasks: T375

Differential Revision: https://review.inboxapp.com/D422
Validate recipients for drafts/sending.

Summary:
Add logic to validate the formatting of the to/cc/bcc fields for the drafts and
Fsending APIs. Also validate the actual email addresses to the extent possible
for the /send endpoint, since we might as well fail directly if you try to send
to an invalid email address.

Fixes T374.

Test Plan: Unit tests added.

Reviewers: charles

Reviewed By: charles

Maniphest Tasks: T374

Differential Revision: https://review.inboxapp.com/D426
setup.sh: Try harder to upgrade setuptools

Summary:
Ubuntu precise and Debian wheezy come with an old version of
python-setuptools, which is actually an obsolete fork of setuptools
called 'distribute'.  distribute prevents itself from upgrading to the
original setuptools, i.e. "easy_install 'setuptools>=5.3'" is a no-op.

distribute has since been merged back into setuptools, and new versions
of pip are capable of properly upgrading setuptools, so we must upgrade
pip before upgrading setuptools.

It looks like I broke this in 8f0fa83a3bf3a2fdd9120a42e72e9deffac9b791.

Test Plan:
- Fully provisioning from scratch is still broken, but after some manual
  tweaking of unrelated stuff, "easy_install --version" now returns
  "setuptools 5.7".

Reviewers: charles, spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D423
[events/recurrence] Cap the recurrence field to column max for now.

Summary:
Cap recurrence field so we don't throw an exception when it's too
long. This is hacky-solution, however since we aren't supporting recurrence or
syncback for now, this solution is a sufficient stop-gap approach to avoid the
exception.

Fixes T385

Test Plan: regression + code review

Reviewers: emfree

Reviewed By: emfree

Maniphest Tasks: T385

Differential Revision: https://review.inboxapp.com/D425
Don't explicitly kill greenlets in unit tests.

We don't actually need to do this.
Fail more informatively when tests are affected by syncback race condition.

If you have a syncback service running in the background and talking to the
test database, it will grab actions enqueued by the tests, causing the tests to
fail cryptically. Detect this case, and raise a more informative error.
Remove unused test fixture.
Revert encryption of secrets, blocks.

Existing data on s3 has to be encrypted before this is rolled out
so as to preserve data integrity and ensure accurate encryption status
is stored in the Block table.

Commits reverted -
a8f4be: "Check for None in migration 088."
c9bd77: "Helper script to re-encrypt secrets."
af6cb8: "New scheme for EAS passwords encryption."
eb47f4: "[SCHEMA][DEPENDENCIES] Encryption of secrets (passwords, refresh_tokens) and blocks."
        Conflicts:
	        inbox/models/roles.py
	        requirements.txt
	        tests/data/base_dump.sql
	        tests/general/test_storage.py

Migrations renamed, test DB updated too.

Sync runs as before.
All tests pass.
Revert "Fail more informatively when tests are affected by syncback race condition."

This reverts commit 2495171ea09ac48f08b8e1bf82b17041acb5fa5f.

Reason for rollback: causes IOError when you try to run the whole test suite.
Remove tests/general/test_storage.py too
[mailsync] Remove noisy logs from imap mailsync.
[inbox/actions] Fix a missing part->block change.
[tests/system] Allow nesting of @timeout_loop decorated functions.
Revert encryption migration.
Consolidate ALTER statements and remove subquery within DELETE.

MySQL won't allow a DELETE with a subquery on the same table in case of
cycles, so we need to execute the subquery separately. We also combine
ALTER statements on the same table to let the database optimize the
operation.
Consolidate ALTER statements for migration performance.

Summary:
Doing multiple ALTERs separately may result in multiple table copies. This
modification makes this migration run in ~3min on production. (Not sure what
it was before except for "longer".)

Test Plan: comparison of emitted SQL with echo=True

Reviewers: charles

Reviewed By: charles

Differential Revision: https://review.inboxapp.com/D430
[SCHEMA] Revert EAS passwords migration.
Remove migration 091, not needed anymore.