Commit Graph

20593 Commits

Author SHA1 Message Date
Tim Abbott 1560646144 renumber-migrations: Fix construction of new number. 2017-08-27 12:01:06 -07:00
Tim Abbott 96dcb8f745 renumber-migrations: Fix unnecessary prompt.
The tool already knows the answer anyway.

Fixes #6157.
2017-08-27 12:01:06 -07:00
Sarah e280a5f8e8 docs: Update new feature tutorial.
Update new feature tutorial to describe recent changes
to the backend and front end processes based on
refactoring.
2017-08-27 11:37:43 -07:00
Aditya Bansal b232563e12 soft-deactivation: Add cron job for weekly soft deactivating users. 2017-08-27 11:33:06 -07:00
Aditya Bansal 9d7e23c100 softdeactivation/management: Make specifying realm an optional arg. 2017-08-27 11:33:06 -07:00
Tim Abbott ed31a5988c models: fix badly line-wrapped type annotation.
Fixes #6290.
2017-08-27 11:27:07 -07:00
Preston Hansen e8a608f733 management: Move enqueue_digest_email handler to digest. 2017-08-27 10:13:11 -07:00
Preston Hansen 9a4b17cf9b management: Move queue_digest_recipient to digest. 2017-08-27 10:13:11 -07:00
Preston Hansen 2aabf4fc67 management: Move should_process_digest to digest. 2017-08-27 10:13:11 -07:00
Preston Hansen 25a40806df management: Move inactive_since to digest. 2017-08-27 10:13:11 -07:00
Tim Abbott f1648af607 migrations: Update UserMessage model for is_me_message removal.
And while we're at it, document the related migration we need to do.
2017-08-27 10:11:43 -07:00
Tim Abbott 8c5525c5c6 requirements: Upgrade versions of Zulip API libraries. 2017-08-27 10:05:45 -07:00
Tim Abbott 1c8c5cc36f test_messages: Fix deactivation tests for new /me behavior. 2017-08-27 09:58:02 -07:00
Tim Abbott eb4635804f compose: Fix previews of /me messages.
Previously, we didn't do anything special when previewing /me messages.

Fixes #2115.
2017-08-27 09:48:27 -07:00
Tim Abbott e80f93dc42 markdown: Set is_me_message in apply_markdown.
This should make the variable available to things like drafts and
previews.
2017-08-27 09:34:24 -07:00
Tim Abbott 133f005530 markdown: Remove is_me_message UserMessage flags.
This never made sense to be a flag on the UserMessage table, since
it's not per-user state.  And in fact it doesn't need to be in a
database at all, since it's easily computed from content anyway.

Fixes #1099.
2017-08-27 09:34:24 -07:00
Tim Abbott 0f1768d0d1 compose: Fix confusing variable name in preview code path.
This seems to be the root cause of the bug fixed in the last commit.
2017-08-27 09:34:06 -07:00
Tim Abbott eb6d736df3 compose: Fix local rendering of previews.
Apparently, local rendering of previews had broken sometime in the
last few months in a refactoring that resulted in us passing a string,
rather than an object, into markdown.js.
2017-08-27 09:33:52 -07:00
Tim Abbott e5da9966c2 bugdown: Remove now-unnecessary short_names.
This field hasn't been used since we removed the related mention
syntax.
2017-08-27 08:45:02 -07:00
Tim Abbott 92efe94a27 tests: Remove unnecessary apns mock. 2017-08-26 15:00:08 -07:00
Tim Abbott f0637cb01a push_notifications: Fix one last lint error. 2017-08-26 14:34:17 -07:00
Tim Abbott 00036ac8db push_notifications: Fix mypy error. 2017-08-26 14:33:43 -07:00
Rishi Gupta 1215757217 send_email: Remove confusing comment. 2017-08-26 14:24:32 -07:00
Rishi Gupta 1a43ef40cf emails: Add email_images_base_uri to context in build_email. 2017-08-26 14:24:32 -07:00
Tim Abbott 2026921270 provision: Bump PROVISION_VERSION for new APNS. 2017-08-26 14:22:31 -07:00
Greg Price 613d093d7d push notifs: Implement APNs with new API.
And it works!

A couple of things still to do:

 * When a device token is no longer active, we'll get HTTP status 410.
   We should then remove the token from the database so we don't keep
   trying to push to it.  This is fairly urgent.

 * The library we're using has a nice asynchronous API, but this
   version doesn't use it.  This is OK now, but async will be
   essential at scale.
2017-08-26 14:16:05 -07:00
Greg Price 35db1b2f11 push notifs: Organize imports. 2017-08-26 14:16:05 -07:00
Greg Price c6d9fbd87b APNs: Replace `apns` dependency with `apns2`.
This is "PyAPNs2", which implements Apple's new (since 2015)
APNs provider API.
2017-08-26 14:16:05 -07:00
Greg Price ba673526ab push notifs: Organize the code a bit.
This commit only reorders the code in the file, without touching the
insides of any function, and adds some heading comments.
2017-08-26 14:16:05 -07:00
Greg Price d02101a401 APNs: Rip out the existing, broken implementation.
This code empirically doesn't work.  It's not entirely clear why, even
having done quite a bit of debugging; partly because the code is quite
convoluted, and because it shows the symptoms of people making changes
over time without really understanding how it was supposed to work.

Moreover, this code targets an old version of the APNs provider API.
Apple deprecated that in 2015, in favor of a shiny new one which uses
HTTP/2 to meet the same needs for concurrency and scale that the old
one had to do a bunch of ad-hoc protocol design for.

So, rip this code out.  We'll build a pathway to the new API from
scratch; it's not that complicated.
2017-08-26 14:16:05 -07:00
Greg Price 3bceeec89f push notifs: Add logging on creating device tokens.
We'd been getting errors from APNs that appeared to say that the
device tokens we were trying to send to were invalid.  It turned out
that the device tokens didn't match the "topic" (i.e. app ID) we were
sending, which was because the topic was wrong, which was because we
were using the wrong SSL cert.  But for a while we thought it might be
that we were somehow messing up the device tokens we put into the
database.  This logging helped us work out that wasn't the issue, and
would have helped our debugging sooner.
2017-08-26 14:16:05 -07:00
Aditya Bansal f0c4f4d4bc soft-deactivation: Stop creating flag list for soft-deactivated users. 2017-08-26 13:48:16 -07:00
Tim Abbott 27101ae931 trello: Use client_head wrapper in tests. 2017-08-26 13:45:27 -07:00
Tim Abbott f51f89a86e test_upload: Explicitly declare subdomains. 2017-08-26 13:45:27 -07:00
Tim Abbott d18f389bb5 test_messages: Set subdomain explicitly in most tests. 2017-08-26 13:45:27 -07:00
Tim Abbott f48bad2734 test_signup: Remove now-unnecessary mocking of subdomain. 2017-08-26 13:45:27 -07:00
Tim Abbott 9c85ccf70f test_signup: Use HostRequestMock.
PostRequestMock is less useful and going to break soon.
2017-08-26 13:45:27 -07:00
rht e2e56a3e71 test_subs: Fix dict unpacking. 2017-08-26 09:01:10 -07:00
rht 437b2a3146 Update "MacOS" text to "macOS" 2017-08-26 09:00:42 -07:00
Greg Price c4915aaff9 feedback: Add type on Redis-fetched data.
This brings type-checking to the last place we fetch
data from Redis, with the exception of our APNs code
which is being replaced (with a Redis-free version,
thanks to improvements in Apple's APNs API) shortly.
2017-08-25 16:14:33 -07:00
Greg Price 5ba4b1bd4f rate_limiter: Add types on Redis-fetched data.
This gives us type-checking, to help prevent bugs like the
last couple of commits fixed in our Tornado code and our
missed-message email handling.  Fortunately no behavior
changes are needed here.
2017-08-25 16:14:33 -07:00
Greg Price b63e995e82 tornado: Fix a Redis-caused str/bytes bug in `status_inquiries`.
Because the Redis client returns exclusively bytes -- even for
hash keys -- even on Python 3, the test `'response' in status`
was always returning false, and the line that tries to decode
as JSON was never running, so we were passing `response`
through as a `bytes` object encoding some JSON.

I'm not sure what the impact of this bug was, and in particular
whether something downstream would have fudged it to make up for
this error.
2017-08-25 16:14:33 -07:00
Greg Price dfbd80f302 email_mirror: Convert subjects back to str from Redis's bytes.
Redis and the Redis client know nothing but bytes.  When we take a
`bytes` object it returns and pass it down as `subject` here, it
causes an exception deep inside message processing if the realm has
any filters, when `bugdown.subject_links` attempts to search the
subject for the filters, which are of course `str` patterns.

For symmetry, make the conversion to bytes on the storing side
explicit too.
2017-08-25 16:14:33 -07:00
Tim Abbott 20c0d27317 test_narrow: Specify subdomains explicitly. 2017-08-25 16:09:52 -07:00
Tim Abbott edc095db6d test_subs: Explicitly declare subdomains. 2017-08-25 16:09:51 -07:00
Tim Abbott 6caca80ab7 test_presence: Specify subdomains for Zephyr tests. 2017-08-25 16:08:37 -07:00
Tim Abbott 7a5eb9dd9f tornado: Add support for testing with subdomains. 2017-08-25 15:42:58 -07:00
Tim Abbott acdeaca2a8 test_zephyr: Explictly declare subdomain in requests. 2017-08-25 15:42:50 -07:00
Tim Abbott 43cfe73908 tests: Make requests use the "zulip" subdomain by default.
Previously, we didn't pass customized HTTP_HOST headers when making
network requests.  As we move towards a world where everything is on a
subdomain, we'll want to start doing that.

The vast majority of our test code is written to interact with the
default "zulip" realm, which has a subdomain of "zulip".  While
probably longer-term, we'll wish this was the root domain, for now, we
need to make our HTTP requests match what is expected by the test
code.

This commit almost certainly introduces some weird bugs where code was
expecting a different subdomain but the tests doesn't fail yet.  It's
not clear how to find all of these, but I've done some grepping.
2017-08-25 15:42:49 -07:00
Tim Abbott ba64d4ee29 server_settings: Add additional subdomains test case.
This will help preserve 100% test coverage as we refactor to set
REALMS_HAVE_SUBDOMAINS=True unconditonally.
2017-08-25 15:42:43 -07:00