Fix Sentry message truncation.

In an illustrative example of the hazards of constructing an untyped data model
out of dictionaries and lists, raven's RemoveStackLocalsProcessor doesn't do
what it says on the box, so neither does our code based on it. Put together
something that should work better until we can submit a PR upstream.
[DEPENDENCIES] Switch to our fork of html2text.

PR submitted upstream, but don't want to just sit around and wait for the next
release.

Fixes T265.
[migrations] Name the migrations in order.
Don't fail in crispin.py when supports_condstore attribute is missing.

Outlook is generic IMAP, but the OutlookAccount class doesn't have the
supports_condstore attribute.

Fixes T272.
Fix typo in previous commit.
[events] Initial checkin of event support.

Summary: This is the initial event support which syncs google events and stores them in the backend. It is based mostly off of the contact sync.

Test Plan: Auth google accounts which have events in the calendar and make sure they're added to the api, just once.

Reviewers: mg, emfree

Reviewed By: emfree

Subscribers: mg, spang

Differential Revision: https://review.inboxapp.com/D308
[events] Add remote sync test events.
Update a thread's folders when we detect deleted ImapUids.

Summary:
This means that, for example, we remove the 'inbox' tag from a thread if it's
removed from the Gmail inbox during an initial sync.

We don't yet deal with the case that a message is deleted entirely (e.g., from
both Inbox and All Mail on Gmail).

Fixes T271.

Test Plan: Start a sync and archive some mail from the top of the inbox.

Reviewers: spang

Reviewed By: spang

Maniphest Tasks: T271

Differential Revision: https://review.inboxapp.com/D312
Make update_thread_labels more performant.

The updating-labels-on-a-thread situation still needs more attention, but in
the meantime, at least make this faster. Doing thread.folders = {...} proves to
be expensive, because sqlalchemy does thread.folders.clear() under the hood,
so we remove all the associated tags and so on. But then in the common case we
just reconstruct the same set of folders, and it's a whole lotta SQL for
nothing. Something to keep in mind when working with the ORM.
Distinguish between canonical and reserved tag names.

Canonical tags are ones that always exist in the Inbox API. Reserved tags
are ones that we prevent users from creating, because we might use them in the
future or because of confusion potential. Don't actually create tag objects for
the latter category.

Fixes T166.
[SCHEMA] Monocle performance.

Summary:
Basic cache.
Monocle's been running this for ~2 days, it's probably the reason
it's been running at all (post the % push).

Only load reqd. Account columns.
This requires the migration + hence cannot be accurately tested on Monocle yet.

Test Plan: Visual.

Reviewers: spang

Differential Revision: https://review.inboxapp.com/D311
Migration update.
Fix to 'cannot acquire gevent lock'.
Revert "Fix to 'cannot acquire gevent lock'."

This reverts commit c526c0bad1bc97ea5c16e5a8f2da7055c7a99243.
Fix to 'cannot acquire gevent lock' (unreverted)

Summary:
service.start_sync() checks if the account's already locked and its sync_state is killed - if so, unlock before trying to
reacquire the lock.

Test Plan: None.

Reviewers: emfree

Differential Revision: https://review.inboxapp.com/D314
Revert commits pending CR
Adapt new code for Contacts to work with EAS.

Test plan:
All tests in tests/general/contacts + tests/api/test_contacts.py pass.
EAS sync does not fail.
Fix yahoo-none for custom folders.

Summary: Fixes T270.

Test Plan: Ran a sync. Saw that the bug had disappeared.

Reviewers: spang, emfree

Reviewed By: emfree

Maniphest Tasks: T270, T262

Differential Revision: https://review.inboxapp.com/D309
[Monocle] Basic cache.