Commit Graph

20616 Commits

Author SHA1 Message Date
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
Tim Abbott 64e895533b test_docs: Add tests for different subdomain states.
This helps maintain 100% test coverage on the new test_classes code.
2017-08-25 15:42:43 -07:00
Tim Abbott b0c8404622 tests: Add subdomain option to client_get and friends.
This should help make it easy to set the domain explicitly in tests
where that's important.
2017-08-25 15:42:42 -07:00
Tim Abbott d449346bb5 puppet: Fix process leaks in small-server configuration.
Whenever you restarted supervisord services, we'd end up leaking one
process from the process_queue group, eventually resulting in running
out of memory.

Fixes #6184.
2017-08-25 12:36:29 -07:00
Tim Abbott f91a2a8ef2 supervisord: Improve memory footprint for small servers.
This cuts the number of uwsgi and message_sender works for smaller
servers with only 2GB of RAM.
2017-08-25 12:34:41 -07:00
neiljp (Neil Pilgrim) 92985f888b mypy: Adjust check of json from github in update-authors-json. 2017-08-25 12:04:15 -07:00
neiljp (Neil Pilgrim) a059872856 mypy: Clarify xml.find use in build_emoji:code_point_to_file_name_map. 2017-08-25 12:04:15 -07:00
Tim Abbott 4b709de9c9 python3: Remove six.PY2/six.PY3 checks. 2017-08-25 11:06:43 -07:00
Tim Abbott 4229faf36e tests: Remove old six.PY2 code paths. 2017-08-25 11:05:16 -07:00
Tim Abbott b8e7369dee mypy: Remove type: ignores not needed in Python 3. 2017-08-25 11:04:20 -07:00
Tim Abbott 55f0555c8d requirements: Update mypy to latest master. 2017-08-25 10:53:10 -07:00
Tim Abbott b4d698f0db js-dep-visualizer: Report the PNG file as well. 2017-08-25 10:43:37 -07:00
Vaida Plankyte a492fc80ed hello.html: Change feature images to SVGs. 2017-08-25 10:30:22 -07:00
Tim Abbott 498c298c14 rate_limiter: Fix buggy use of NotImplementedError. 2017-08-25 09:53:09 -07:00
Tim Abbott 8b2cd96126 confirmation: Fix arguments to super().
This and the last half-dozen commits were identified by lgtm.
2017-08-25 09:49:45 -07:00
Tim Abbott bee86b6e6b send_email: Fix modification of mutable default value. 2017-08-25 09:43:53 -07:00
Tim Abbott 537ad1ff1b templatetags: Fix buggy exception clause. 2017-08-25 00:39:58 -07:00
Tim Abbott 1bb09e35d2 message: Add assertions for invalid recipient types. 2017-08-25 00:39:36 -07:00
Tim Abbott f3c73e4aa4 actions: Add assertion for invalid flag operations. 2017-08-25 00:34:56 -07:00
Tim Abbott 35f1bbb968 process_new_human_user: Simplify prereg_user logic.
We don't need the old code paths now that we don't have an MitUser
model anymore.
2017-08-25 00:34:06 -07:00
Tim Abbott 8df7deac9d deactivation: Add some styling to make boxes smaller. 2017-08-25 00:16:35 -07:00
Umair Khan 9720d3a986 accounts_register: Use redirect_to_deactivation_notice. 2017-08-25 00:09:06 -07:00
Umair Khan 43c40f6144 Add tests for deactivation notice. 2017-08-25 00:09:06 -07:00
Umair Khan abda7ee853 Upgrade deactivated.html to use white box. 2017-08-25 00:09:06 -07:00
Umair Khan b473ff54ce Show realm deactivation notice for login/register.
Fixes #6247
2017-08-25 00:09:06 -07:00
Tim Abbott 07a156c400 notifications: Fix desktop/sound notifications for @all.
It appears that previously, these weren't being triggered.
2017-08-24 23:56:10 -07:00
Tim Abbott a2c21543bc mentions: Fix mention state being lost after reload.
This fixes a regression introduced in
bc2069aec2, which caused @-all mentions
to not be displayed properly.

Fixes #5317.
2017-08-24 23:47:55 -07:00
Cynthia Lin 8addc9b97e message view: Maintain stream color border on @-mention messages.
Fixes #6241
2017-08-24 23:37:59 -07:00