Tim Abbott
b5c107ed27
push_notifications: Remove unnecessary check for no devices.
...
This should have been checked by the caller anyway.
2017-10-13 17:30:20 -07:00
Tim Abbott
27a450b58d
push_notifications: Improve error message for GCM sending issues.
...
This addresses one of the sources of confusion in #6993 .
2017-10-13 17:30:11 -07:00
Tim Abbott
676a6af8cb
push_notifications: Get back to 100% test coverage.
...
We didn't have tests for a few new code paths.
2017-10-11 20:17:27 -07:00
Tim Abbott
298c59f7fd
push_notifications: Fix error message for unregistered bouncer.
...
Previously, we were just returning a JSON error to the client, when it
was a server problem.
Fixes #6639 .
2017-10-11 19:09:24 -07:00
Harshit Bansal
7b88e3eea7
tests: Add a test suite for verifying the mobile push notifs content.
...
This test suite works by using the expected_output and new text_output
fields in the bugdown test cases to verify that each syntax is
correctly translated by this new function.
Some of these translations, like strikethrough, are kinda poor; but
this framework should make it easy to iterate on the formatting.
Fixes : #6720 .
2017-10-06 16:47:27 -07:00
Harshit Bansal
5a6584890d
push_notifications: Start using `get_mobile_push_content()` function.
2017-10-06 16:47:25 -07:00
kunall17
f091823fc8
push_notifications: Set APNS badge as 0 for now.
...
We don't yet have support for tracking the number of open APNS
notifications server-side, so setting this to 0 will at least avoid
confusing users.
2017-10-03 17:07:49 -07:00
Tim Abbott
7581e0e1c5
settings: Remove remaining references to REALMS_HAVE_SUBDOMAINS.
2017-10-02 16:43:54 -07:00
derAnfaenger
d1afab7199
Replace deprecated Logging.warn calls with Logging.warning.
2017-10-02 11:11:42 +02:00
Greg Price
7b8f725707
APNs: Accept 1.6-format payloads in bouncer.
...
This is just enough of a quick fix to work with a stock Zulip 1.6
server. We should really also make this robust to arbitrary input
from the remote Zulip server, even though it'll be a little tedious.
2017-09-28 10:01:16 -07:00
rht
26f5d9a32c
zerver/tests: Remove print_function.
2017-09-27 18:05:45 -07:00
rht
1e87a4b68c
zerver/tests: Remove absolute_import.
2017-09-27 10:00:39 -07:00
kunall17
1436d558a3
APNs: Add message body to notification payload.
...
(Edited by greg to leave the badge logic as is for now.)
2017-09-18 16:37:02 -07:00
Tim Abbott
5722237f59
push: Rename received_pm to private_message.
...
This is a clearer name for this now more broadly used interface.
2017-09-14 05:41:37 -07:00
Sarah
97571a203d
push: Add new formatting for stream message push and add tests.
...
This should make the push notifications for messages to streams with
the new stream push notifications setting enabled make sense.
2017-09-14 05:41:37 -07:00
Sarah
c3a8138f74
user_settings: Add push notifications for all stream messages.
...
Add setting to enable push notifications for all stream messages.
2017-09-14 05:41:37 -07:00
Greg Price
a4bcf1a64b
APNs: Handle HTTP connection errors, and retry.
...
Should help with #6321 as at least a band-aid.
2017-08-29 15:27:41 -07:00
Greg Price
780e1ac5b2
push notifs: Add a simple test for the new APNs provider.
2017-08-29 15:27:41 -07:00
Steve Howell
0959c978c3
Fix lint error from recent subdomains commit.
...
We did a code sweep recently for subdomains (see
60be89d0
).
2017-08-29 08:35:37 -07:00
Tim Abbott
60be89d00e
test_push_notifications: Declare subdomains explicitly.
2017-08-28 23:19:07 -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
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
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
Tim Abbott
b8e7369dee
mypy: Remove type: ignores not needed in Python 3.
2017-08-25 11:04:20 -07:00
Umair Khan
a5c05f9812
push_notification: Retry event in case of error.
...
Fixes #5301
2017-08-22 11:16:48 -07:00
Tim Abbott
47eb7ee003
push_notifications: Fix incorrect URL being used in bouncer test.
...
This was actually testing the validation in the direct push
notifications code path, not the push notification boucner code path.
2017-07-31 13:08:06 -07:00
Greg Price
e18baff32c
JsonableError: Rename message from `error` to `msg`.
...
The whole thing is an error, so "message" is a more apt word for the
error message specifically. We abbreviate that as `msg` in the actual
HTTP responses and in the signatures of `json_error` and friends, so
do the same here.
2017-07-24 16:41:22 -07:00
Tim Abbott
0606ba88df
push_notifications: Verify that token types are valid.
...
We only have two types of push notification tokens, so we should
validate that in the bouncer code path.
2017-07-07 10:28:36 -07:00
Tim Abbott
eaa33cce73
push_notifications: Validate format of APNS tokens.
...
This fixes a bug where we would previously not validate the format of
APNS tokens before writing them to the database, which could lead to
exceptions in the push notifications system if a buggy mobile app
submitted invalid format tokens.
2017-07-07 10:28:36 -07:00
kunall17
d8310724b6
Use absolute URLs in GCM push notifications.
...
This will eventually allow us to simplify the logic required for the
mobile apps processing GCM notifications.
2017-06-15 03:56:59 -07:00
Vishnu Ks
5230eaef1c
Replace hamlet@zulip.com with example_email('hamlet').
2017-05-24 19:37:36 -07:00
Rick Chern
e53d1c3885
tests: Remove get_user_profile_by_email from most tests.
2017-05-24 13:05:19 -07:00
Umair Khan
38ecc35cd9
push_notifications: Catch IOError while pushing to GCM.
2017-05-17 12:14:32 -07:00
Umair Khan
7e8f4ca4e8
push_notifications: Include GCM in end-to-end test.
2017-05-17 08:09:19 -07:00
Tim Abbott
9d63a5ab3a
push_notification: Delete obsolete DBX_IOS_APP_ID code.
...
I'm not sure that this was ever actually used, but it's definitely
just clutter for Zulip today.
2017-05-16 12:26:55 -07:00
Umair Khan
fa5c66c439
push_notifications: Add num_push_devices_for_user tests.
2017-05-16 12:26:55 -07:00
Umair Khan
88f5d29e19
push_notifications: Add send_to_push_bouncer tests.
2017-05-16 12:26:55 -07:00
Umair Khan
af27ad607a
push_notifications: Add handle_push_notification tests.
2017-05-16 12:26:55 -07:00
Umair Khan
8a6498f55d
push_notifications: Create BouncerTestCase.
...
Adds bounce_request method to simulate a bounce.
2017-05-16 12:26:55 -07:00
Umair Khan
5907877038
push_notifications: Add test for send_notifications_to_bouncer.
2017-05-16 12:26:55 -07:00
Umair Khan
fab4249893
push_notifications: Add get_gcm_payload tests.
2017-05-16 12:26:55 -07:00
Umair Khan
136a950041
push_notifications: Add test for APNs payload.
2017-05-16 12:26:55 -07:00
Umair Khan
47d0f7d996
push_notifications: Add tests for get_alert_from_message.
2017-05-16 12:26:55 -07:00
Umair Khan
df0d29aaff
push_notifications: Add response_listener tests.
2017-05-16 12:26:55 -07:00
Steve Howell
b609911656
Remove unused get_user_profile_by_email() imports.
2017-05-08 11:57:38 -07:00
Steve Howell
7f9057ba99
tests: Use example_user() in more places.
2017-05-08 11:57:38 -07:00
Steve Howell
6bc8424c71
Use self.example_user() in more places.
...
This fixes most cases where we were assigning a user to
the var email and then calling get_user_profile_by_email with
that var.
(This was fixed mostly with a script.)
2017-05-08 11:57:38 -07:00
Aditya Bansal
fd4ac33073
pep8: Add compliance with rule E261 to test_push_notifications.py.
2017-05-07 23:21:50 -07:00
Tim Abbott
c0d7e83333
logging: Change missing push notification keys from error to warning.
...
This is a configuration problem, but it just means a feature is not
enabled, not that attention is required, so it should be a warning,
not an error.
2017-04-25 13:52:36 -07:00