Greg Price
776af2e248
push notifs: Simplify content-truncation code slightly.
...
This should be a pure refactor.
2017-12-18 15:32:56 -08:00
Greg Price
014900c2e5
push notifs: Include same stream and sender info on GCM as on APNs.
...
This takes the information added to APNs payloads by #7080 , and adds
to our GCM payloads the parts that it didn't already have.
2017-12-18 15:32:56 -08:00
Greg Price
e077d6fc74
push notifs: Factor out common payload fields for APNs and GCM.
...
This should be a pure refactor, producing exactly the same payloads.
2017-12-18 15:32:56 -08:00
Greg Price
8a432c5134
APNs: Update comment on versions of our APNs payload format.
2017-12-11 20:55:20 -08:00
kunall17
98943a8333
Include data of stream/private sender details in apns push notifications
2017-12-11 20:51:09 -08:00
Tim Abbott
6bc1a682de
notifications: Separate push and email notifications checks.
...
This is an early step in a larger refactor to properly decouple the
email and push notification code paths.
2017-11-28 17:51:18 -08:00
rht
ee546a33a3
zerver/lib: Use python 3 syntax for typing.
...
Edited by tabbott to improve various line-wrapping decisions.
2017-11-28 17:15:14 -08:00
rht
229a8b38c0
zerver/lib: Use Python 3 syntax for typing for several files.
...
This adds a number of annotations that had been missed in previous
passes.
2017-11-28 17:02:24 -08:00
Tim Abbott
982bd9c38d
Fix push notifications for soft-deactivated users.
...
Previously, these push notification events were being generated, but
then ignored in handle_push_notification because there was no
user_message object.
2017-11-09 15:52:29 -08:00
Tim Abbott
c99d20db63
push_notifications: Shrink scope of try/except block.
...
There's no reason this needed to indent the entire function.
2017-11-09 15:30:21 -08:00
Tim Abbott
64b4d83038
push_notifications: Improve debugging of lookup problems.
...
We're having this error being thrown often, and don't know why.
2017-11-09 15:20:24 -08:00
rht
19bd335cbb
Change urllib import to be Python 3-specific.
2017-11-07 10:46:42 -08:00
Steve Howell
8302689789
Extract Message.is_stream_message().
...
This sets us up to denormalize on to Message some notion of
whether a message is for a stream (without having to hit the
Recipient table).
2017-10-28 17:57:39 -07:00
Tim Abbott
fa55d7ed33
retry_event: Remove requirement of failed_tries being already there.
...
This fixes a bug where retries in the signups queue threw an exception.
2017-10-27 18:15:53 -07:00
Tim Abbott
be619fe881
lint: Wrap many very long lines in the Python codebase.
...
This decreases the maximum line length in our Python codebase to 130.
2017-10-26 17:31:58 -07:00
Maarten Rijke
841f02934d
push_notifications: Add setting to redact content.
...
This commit adds a setting that toggles redacting content of push
notifications and replacing it with "***REDACTED***".
2017-10-19 18:16:06 -07:00
Tim Abbott
e98ca0714b
notifications: Simplify how triggers are passed around.
...
This removes the utterly unnecessary `triggers` dict (which always was
a dict with exactly one value True) in favor of a single field,
'trigger'.
Inspired by Kunal Gupta's work in #6659 .
2017-10-18 21:42:05 -07:00
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
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
5a6584890d
push_notifications: Start using `get_mobile_push_content()` function.
2017-10-06 16:47:25 -07:00
Harshit Bansal
28628eeaeb
push_notifications: Add `truncate_content()` function.
...
This function truncates the textual content at correct length.
(It will be updated later to handle corner cases of unicode
combining characters and tags when we start supporting them.)
2017-10-06 16:44:19 -07:00
Harshit Bansal
b5a1aacfb3
push_notifications: Add `get_mobile_push_content()` function.
...
Given the rendered content of a message, this function strips
all the markup replacing emojis with their corresponding unicode
representation.
2017-10-06 16:44:18 -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
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
f43e54d352
zerver/lib: 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
a33c98f23e
push_notifications: Require the message.triggers fields to exist.
...
The code was already assuming it implicitly, and making it explicit
improves the readability.
2017-09-16 03:14:56 -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
Tim Abbott
00036ac8db
push_notifications: Fix mypy error.
2017-08-26 14:33:43 -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
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
Umair Khan
a5c05f9812
push_notification: Retry event in case of error.
...
Fixes #5301
2017-08-22 11:16:48 -07:00
Tim Abbott
d6e0960ca2
push_notifications: Fix mypy annotation logic around push tokens.
...
I'm not 100% confident this is long-term correct, but at least it's
consistent.
2017-07-07 10:54:37 -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
Steve Howell
e3c6c22269
Optimize push_notifications.response_listener().
...
We were needlessly getting a UserProfile object out of cache,
when we only needed the user_id.
2017-06-10 10:43:57 -07:00
Aditya Bansal
8680c87f56
pep8: Add compliance with rule E261 zerver/lib/push_notifications.py.
2017-05-31 17:07:15 -07:00
Umair Khan
bc15085098
gcm: Increase retries to 10 while pushing.
2017-05-17 12:14:32 -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
0b2388bda9
push_notifications: Remove DeviceTokenType logic.
...
The syntax wasn't valid on Python 3.5, and the new code is somewhat
more readable anyway.
2017-05-16 12:26:55 -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
286f9a40e7
push_notifications: Bring file to 100% coverage.
2017-05-16 12:26:55 -07:00