Commit Graph

254 Commits

Author SHA1 Message Date
rht 995b300840 zilencer: Remove unused imports (F401). 2017-11-07 16:37:01 -08:00
Tim Abbott 1cd017288d views: Fix imports of REQ/has_request_variables from the wrong place.
These were never in zerver/decorator.py, and so it makes sense to
import them zerver/lib/request.py, mostly for ease of finding things.
2017-10-27 15:07:31 -07:00
Tim Abbott 66a3f514d4 zilencer: Remove long-obsolete Deployment model.
This was a precursor to RemoteZulipServer, which is no longer used for
anything, and was cluttering the codebase.
2017-10-11 23:48:01 -07:00
rht 8d289b8228 zilencer: Remove absolute_import. 2017-09-27 20:20:07 -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
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
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 40425044c4 push_notifications: Validate APNS token format in bouncer.
This prevents a buggy old Zulip server from forwarding invalid-format
push notification tokens to the push notification bouncer service.

As part of this change, we switch the token from Text to str to match
the rest of the code path.
2017-07-07 10:28:36 -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
Umair Khan c4e5b75ead push_notification: Push data from Zilencer. 2017-05-16 12:26:55 -07:00
Umair Khan 4a864c7515 push_notification: Send data to notification bouncer. 2017-05-16 12:26:55 -07:00
Umair Khan e649c05aed views.py: Create validator for remote server. 2017-05-11 12:04:16 -07:00
Tim Abbott cddee49e75 Add support infrastructure for push notification bouncer service.
This is an incomplete cleaned-up continuation of Lisa Neigut's push
notification bouncer work.  It supports registration and
deregistration of individual push tokens with a central push
notification bouncer server.

It still is missing a few things before we can complete this effort:
* A registration form for server admins to configure their server for
  this service, with tests.
* Code (and tests) for actually bouncing the notifications.
2017-04-18 23:03:06 -07:00
Tim Abbott e1c1f96f9e zilencer: Eliminate submit_feedback indirection. 2017-03-06 00:01:57 -08:00
Tim Abbott ed5b76f566 zilencer: Move feedback code to zerver/lib/feedback. 2017-03-06 00:01:57 -08:00
Tim Abbott 1f9d93bc96 submit_feedback: remove unused domainish variable. 2017-03-06 00:01:57 -08:00
Tim Abbott 69061e6db4 zilencer: Remove obsolete lookup_endpoints_for_user endpoint.
This endpoint was part of the same obsolete system as
desktop_sso_dispatch.
2017-03-06 00:01:56 -08:00
Tim Abbott 9e8023843a zilencer: Remove obsolete desktop_sso_dispatch.
This feature has been obsolete since when Zulip was released as open
source software, since it's purpose was to avoid putting a "server
url" prompt in the desktop app, and now that prompt is required
anyway.
2017-03-06 00:01:47 -08:00
Tim Abbott dd9e0b8463 errors: Move do_report_error into zerver/lib/. 2017-01-23 23:18:28 -08:00
Tim Abbott e6fc4ae27d errors: Move zilencer/error_notify.py to zerver/lib/. 2017-01-23 23:17:09 -08:00
Tim Abbott 99c5563bc6 internal_send_message: Make realm argument mandatory.
A lot of care has been taken to ensure we're using the realm that the
message is being sent into, not the realm of the sender, to correctly
handle the logic for cross-realm bot users such as the notifications
bot.
2017-01-21 21:37:30 -08:00
Tommy Ip 3823376b3f zilencer: Fix bare except clause. 2017-01-08 16:22:21 -08:00
Rishi Gupta 2b0a7fd0ba Rename models.get_realm_by_string_id to get_realm.
Finishes the refactoring started in c1bbd8d. The goal of the refactoring is
to change the argument to get_realm from a Realm.domain to a
Realm.string_id. The steps were

* Add a new function, get_realm_by_string_id.

* Change all calls to get_realm to use get_realm_by_string_id instead.

* Remove get_realm.

* (This commit) Rename get_realm_by_string_id to get_realm.

Part of a larger migration to remove the Realm.domain field entirely.
2017-01-04 17:12:23 -08:00
anirudhjain75 beaa62cafa mypy: Convert several directories to use typing.Text.
Specifically, these directories are converted: [analytics/, scripts/,
tools/, zerver/management/, zilencer/, zproject/]
2016-12-07 20:51:05 -08:00
Rishi Gupta 4b183cd526 domain migration: Remove several instances of get_realm.
Remove the easy to remove instances of get_realm.
2016-11-26 15:19:56 -08:00
Rishi Gupta c1713c9659 Prevent code from using email domain to determine realm when subdomains.
Also removes the intermediate step of going through Realm.domain in the
non-subdomains case. Part of a larger project to remove Realm.domain
entirely.
2016-11-11 15:26:51 -08:00
Tim Abbott 95aee366c8 Enable local browser error reporting if ZILENCER_ENABLED. 2016-08-11 13:49:18 -07:00
Tim Abbott 1f2b3588d2 Annotate zilencer/models.py and fix str types in zilencer views. 2016-08-04 15:53:23 -07:00
acrefoot e4ed9195dc Remove rest_dispatch hack and optimize imports.
For a long time, rest_dispatch has had this hack where we have to
create a copy of it in each views file using it, in order to directly
access the globals list in that file.  This removes that hack, instead
making rest_dispatch just use Django's import_string to access the
target method to use.

[tweaked and reorganized from acrefoot's original branch in various
ways by tabbott]
2016-06-24 16:11:03 -07:00
Evan Palmer bd0fd61821 Annotate zilencer.error_notify.
Also fix the annotation of zilencer.views.report_error.

The `report` arguments are a Dict containing both strings and the
`more_info` sub-dictionary, so we type them as Dict[str, Any].

[tweaked by tabbott]
2016-06-07 13:44:56 -07:00
pxhanus e247d9783f Annotate zilencer/views.py. 2016-06-04 22:07:01 -07:00
Umair Khan 08fbd57245 [i18n] Make error messages translatable.
Make all strings passing through `json_error` and `JsonableError`
translatable.

Fixes #727
2016-05-31 07:40:42 -07:00
Tim Abbott 960144a49e Desupport using uninstantiated REQ with has_request_variables.
This makes life difficult for doing static type annotations, and
didn't make the code look that much better anyway.
2016-05-31 07:31:15 -07:00
Tim Abbott a2ef1642d1 Fix buggy report_error return value. 2016-02-03 19:29:44 -08:00
Tim Abbott a79e89b28f Cleanup remaining usage of % comprehensions without explicit tuples. 2015-12-05 15:29:42 -08:00
Tim Abbott 9c66229456 Apply Python 3 futurize transform libfuturize.fixes.fix_absolute_import. 2015-11-01 09:26:16 -08:00
Anders Kaseorg 95afea9006 Remove enterprise registration form
(imported from commit 58914685752bff3c9d0e56ffe21bd3cd367e70e7)
2015-08-20 18:40:34 -07:00
Steve Howell ebce82b136 Eliminate json_to_dict and use check_dict instead.
All usages of json_to_dict were replaced with the check_dict
validator.  The check_dict validations can eventually be
extended to validate the keys and values of incoming data,
but now we just use check_dict([]) in all the places where
we had json_to_dict, which means we aren't checking for any
specific keys; we are just making sure it's a dictionary.

(imported from commit fc5add9a7ef149dfac2a9a6d9a153799c4c0c24d)
2014-02-18 13:02:08 -05:00
Zev Benjamin 6691789cce Add helper function for returning a Redis client
(imported from commit 47f87d388d24343ac6b631181a55287eb8cd4a6d)
2014-02-10 13:23:28 -05:00
Steve Howell 8b09d4da6c Track feedback sender times in redis.
An earlier commit today made it so that we don't create tickets
for feedback if the Python process had seen a message from that
user in the last few minutes.  This doesn't help much when you
have multiple processes, so now we track the times in redis.

(imported from commit 62ff8ceb55d815d03566f407c1c85037334e4d6d)
2014-01-17 13:39:31 -05:00
Steve Howell 4477ee4bba Avoid excessive feedback ticket headers.
(imported from commit 84eb0945e23f670f4d343672dc5589a1867926d6)
2014-01-17 09:59:45 -05:00
Waseem Daher c906db1c21 Less verbose feedback bot.
(imported from commit a62f5a3a86b1e67451851ca87eae9f5a7e6f920f)
2013-12-24 12:31:49 -05:00
Leo Franchi 501f063426 Replace email_to_domain with split_email_to_domain and resolve_email_to_domain
Now that we support email aliases, we have to be careful when going from
an email address to a domain that we assume we can use to get a Realm
object for. When we care about the Realm's domain, we want to follow
any RealmAliases that exist for a certain domain.

When we just care about the original email address domain itself,
for comparison or other purposes, use split_email_from_domain

This removes the ambiguity of having to decide when to use
email_to_domain + RealmAlias or just email_to_domain

(imported from commit 0e199495502d946ce2e1aae56263e7e8665be4ed)
2013-11-26 10:45:01 -05:00
Kevin Mehall 53c76aa657 Move enterprise-registration to zilencer/ from zerver/
(imported from commit d8a58913040376dbdbc9dcee13ab8a7910733da7)
2013-11-15 11:21:52 -05:00
Leo Franchi ea648d19a1 Rename template vars in zilencer's use of login.html for clarify
(imported from commit ffd5aa569054fb3949775a7f3e2e02634b814c06)
2013-11-14 10:56:29 -05:00
Kevin Mehall f7f2ec0aca [puppet] Report enterprise and prod errors to staging.
Errors are sent to a queue processor that posts them to staging,
just like the feedback bot.

(imported from commit 4a8d099672a1b3e48a8bc94148d8b53db73d2c64)
2013-11-13 16:22:21 -05:00
Kevin Mehall 3ec7663cb2 Fix incorrect code to get the deployment name
(imported from commit 134ffafc4b15da77b0bb5ffc84766a3fb4099ae2)
2013-11-13 16:22:21 -05:00
Leo Franchi d13500ac0d Add a email-only sso login page that redirects to a deployment-specific domai
(imported from commit 7134ad71f01b3c22c61c6c0e65f7196efaf92237)
2013-11-08 14:33:12 -05:00
Steve Howell f5bb2409ef Create "analytics" app with activity reports.
(imported from commit 6385935c3d7894fe52bcc265faecc30b07629717)
2013-11-06 12:07:32 -05:00
Steve Howell 83c8f25ac6 Move activity report templates to zilencer.
(imported from commit b546ae89d8ab0ba679672fc3f6b7ef09d0e86d1b)
2013-11-05 15:41:03 -05:00
Steve Howell 5ff6bc7330 Move activity reports to zilencer.
This commit moves the view code and the URLs.  It doesn't touch
the templates yet.

(imported from commit dbef5eafe4956b29154c1134c05aa586c9e417b2)
2013-11-05 15:41:03 -05:00
Tim Abbott 68dcc760c3 Clean up some unused imports.
(imported from commit 0c5d8e2a55ba1b8909ba807fee3afe863dcdc226)
2013-11-04 11:51:17 -05:00
Luke Faraone 2d787e952b Expose an endpoint to identify the API/webclient bases for a particular user.
We fall back to guessing based on the realm if the user doesn't have a
profile in our system

(imported from commit 833885168c451074c885b4422d62986855a215f7)
2013-10-25 15:18:38 -04:00
Luke Faraone e552307511 Send feedback to a queue to be forwarded to staging.
(imported from commit 4a9a1bfc6c95763a816263a726cc61b3ca90bf15)
2013-10-25 14:13:30 -04:00