Eklavya Sharma
73a3c9fa47
On python 3, skip expected failures in backend tests.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
4868cd9969
zerver/lib/test_helpers.py: Add skip_py3 decorator.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
0a9c600c8b
Show skipped tests in test runner.
2016-07-12 09:27:55 -07:00
Eklavya Sharma
958335bdb3
Change all default values in models to unicode.
2016-07-11 21:30:32 -07:00
Tomasz Kolek
d7c7279523
Add is_status_message method to Message model.
2016-07-11 12:09:06 -07:00
Tim Abbott
e21bc11cfd
Extract attachment_url_to_path_id.
2016-07-10 18:07:37 -07:00
Tim Abbott
48ae178d0b
Refactor attachment_url_re to be a common value in upload.py.
2016-07-10 18:04:58 -07:00
rahuldeve
c5756e4fa4
Update attachment tracking on message update.
2016-07-10 18:01:59 -07:00
Tim Abbott
3647973069
update_message_backend: Reorganize validation checks.
...
The new organization more clearly does the permission check first.
2016-07-10 18:01:59 -07:00
Tim Abbott
05632b68e1
edit: Add validation for setting empty content.
2016-07-10 18:01:59 -07:00
Tim Abbott
0d418d5695
Add some message editing tests for invalid input.
2016-07-10 18:01:59 -07:00
Tim Abbott
211a166abc
message edit: Move new topic non-empty check to view.
2016-07-10 18:01:59 -07:00
Eklavya Sharma
0900ca5353
Replace assertItemsEqual by assertEqual.
...
This is needed because assertItemsEqual doesn't exist in python 3.
2016-07-10 17:33:11 -07:00
Rishi Gupta
43c2f35776
Add realm setting to disable message editing.
...
This is controlled through the admin tab and a new field in the Realms
table. This mirrors the behavior of the old hardcoded setting
feature_flags.disable_message_editing. Partially resolves #903 .
2016-07-10 11:57:24 -07:00
Rishi Gupta
07e7230ae1
models.py: Add post_save to Message.
...
Flushes message from cache after a message.save(). Needed for tests
where we directly manipulate Message objects in the database.
2016-07-10 11:42:18 -07:00
Eklavya Sharma
f1ba3ded42
Revert "Extract reply from email."
...
This reverts commit f1f48f305e
.
The use of sklearn unfortunately caused a substantial slowdown to the
Zulip provisioning process, which didn't seem worth it for a
relatively minor feature.
2016-07-10 11:30:30 -07:00
Eklavya Sharma
9161ddaee0
zerver/middleware.py: Handle binary data in errors.
...
In write_log_line, error_content can be binary_type and
error_content_iter can be a Sequence of binary_type. Handle
this this in a python 3 compatible way. Also change annotations
to reflect this fact.
2016-07-10 11:30:13 -07:00
Steve Howell
c671881713
decorators: Extract is_local_addr().
2016-07-09 17:58:48 -07:00
Steve Howell
8e528569a7
Clean up rate_limit() for deployments that opt out.
...
If settings.RATE_LIMITING is False, short circuit rate
limiting earlier in rate_limit(). This change particularly
avoids inspect request.user and possibly spamming the error
log for sites that don't care about rate limiting.
2016-07-09 17:58:20 -07:00
Eklavya Sharma
801bcdd956
zerver/tests/tests.py: Fix non-deterministic failure.
...
Replace occurences of list(d.keys()) by sorted(d.keys()).
2016-07-09 17:54:54 -07:00
Eklavya Sharma
1f3ce7cf38
zerver/worker/queue_processors.py: Open file in binary.
...
Open a file in binary mode instead of text mode.
2016-07-09 17:54:54 -07:00
Eklavya Sharma
2f2e543a0e
zerver/tests/tests.py: Replace assertItemsEqual.
...
Replace assertItemsEqual(a, b) by assertEqual(sorted(a), sorted(b))
because assertItemsEqual has been removed in python 3.
2016-07-09 17:54:54 -07:00
Steve Howell
89105e41d7
Added TestInternalNotifyView.
2016-07-09 07:47:12 -07:00
Steve Howell
ce14a3551d
Added test_get_client_name().
2016-07-09 07:37:13 -07:00
Steve Howell
69f18c26fc
Improve test_api_key_only_webhook_view().
...
This test now covers all lines of api_key_only_webhook_view(),
including the error logic and rate limiting logic.
2016-07-09 07:37:13 -07:00
Steve Howell
3d095beb63
Extracted client_is_exempt_from_rate_limiting().
2016-07-09 07:37:13 -07:00
Steve Howell
49543b9ec4
Added RateLimitTestCase tests.
2016-07-09 07:37:13 -07:00
Steve Howell
c680c6a981
Removed unused to_non_negative_float() function.
2016-07-09 07:37:13 -07:00
Umair Khan
b7ec66fc96
Remove templates, styles and js through storage.
2016-07-09 07:33:35 -07:00
Umair Khan
043ae8ad65
Upgrade to Django-Pipeline==1.6.8.
2016-07-09 07:09:55 -07:00
Umair Khan
2d243c0703
get_all_templates should not return __init__.py.
2016-07-09 07:09:55 -07:00
Tim Abbott
1e2d38e790
Move stringify_message_dict into to_dict_uncached.
2016-07-08 17:58:56 -07:00
Tim Abbott
72e948d19a
Remove now-unused message_cache_key message cache.
...
Originally this cache was used to transmit data from Django to Tornado
(and also for general message caching purposes), but now nothing
actually reads from this cache, so we can eliminate it.
2016-07-08 17:58:56 -07:00
Tim Abbott
8d5ec14b31
cache_helpers: Fill to_dict cache instead of old message cache.
...
Apparently, the message cache we were filling was completely useless
and unused, and furthermore, the cache we were filling as part of
restarting the server was also totally useless, since it didn't have
the messages users would be requesting.
2016-07-08 17:58:56 -07:00
Taranjeet
a8a4caf2c0
zerver: Fix lines with length greater than 120.
2016-07-08 11:41:43 -07:00
Umair Khan
f1f48f305e
Extract reply from email.
2016-07-08 10:58:25 -07:00
Umair Khan
75bd3541ea
Add tests for new email policy.
...
- Update test_extra_context_in_missed_stream_messages
- Add test_extra_context_in_personal_missed_stream_messages
- Add test_extra_context_in_huddle_missed_stream_messages
2016-07-08 10:58:25 -07:00
Umair Khan
8538ba8ea8
Remove do_send_missedmessage_events function.
2016-07-08 10:58:25 -07:00
Umair Khan
06355105f5
Missed message emails should come from user email.
...
Fixes #448
FIxes #612
2016-07-08 10:58:25 -07:00
Eklavya Sharma
3e9349df4f
zerver/decorator.py: Use force_bytes instead of encode.
...
The value type of request.META is str, not text type.
So use force_bytes on the data instead of encode('utf-8').
2016-07-08 01:24:30 +05:30
Eklavya Sharma
4cf7641ab1
zerver/tests/test_i18n.py: Ignore due to incomplete stubs.
...
In python 3, http.cookies has incomplete stubs.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
6c3f1bb967
beanstalk.py: Encode and decode strings correctly.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
26b8e7357a
zerver/views/messages.py: Operate on bytes in highlight_string.
2016-07-07 12:42:51 -07:00
Eklavya Sharma
83640ed0cd
runtornado.py: Ignore due to incorrect stubs.
2016-07-07 10:09:35 -07:00
Eklavya Sharma
6fd8906358
rename_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:08:29 -07:00
Eklavya Sharma
c679c180f5
enqueue_file.py: Add type hint for mypy.
2016-07-07 10:07:51 -07:00
Eklavya Sharma
896c18a57b
email-mirror.py: Make it pass on mypy in python 3.
...
* Replace filter by list comprehension.
* Add '# type: ignore' to statements which use attributes from
modeule `posix`, since stubs for posix are missing on python 3.
2016-07-07 10:07:28 -07:00
Eklavya Sharma
17cb6e00bd
create_stream.py: Fix broken code.
...
* get_realm returns None if no matching realm is present, but
create_stream.py assumed it raises Realm.DoesNotExist.
* encoded/decode strings properly.
2016-07-07 10:06:39 -07:00
Eklavya Sharma
7956fcbf0d
zerver/lib/str_utils.py: Allow specifying encoding.
2016-07-07 10:06:22 -07:00
Eklavya Sharma
63d55bdd86
zerver/views/__init__.py: decode b64encoded ccache.
...
Convert b64encoded ccache to `str` before passing to
subprocess.check_call.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
628e45defc
zerver/lib/actions.py: Use text_type in truncate_ functions.
...
The functions truncate_content, truncate_body and truncate_topic
are only meant to be used on text strings. So change its
parameter types from AnyStr to text_type.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
976858f536
tornado_ioloop_logging.py: Ignore because of missing stub.
...
There is no stub for select.epoll on python 3. So ignore the
statement which uses it.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
9d2a539aaa
zerver/lib/notifications.py: Add hints for mypy.
...
Add type hints for mypy using isinstance in assert and if.
2016-07-07 10:02:08 -07:00
Tim Abbott
98db1d996f
email_mirror: Fix some indentation issues.
2016-07-07 10:02:08 -07:00
Eklavya Sharma
5e81a4d93f
zerver/lib/email_mirror.py: Improve annotation in python 3.
...
Add asserts and if statements to help mypy.
2016-07-07 10:01:30 -07:00
Eklavya Sharma
4f221c21a0
zerver/lib/email_mirror.py: Improve subject extraction.
...
Improve subject extraction in process_message.
2016-07-07 09:55:23 -07:00
Eklavya Sharma
06a7a6caee
zerver/lib/debug.py: Remove from mypy's exclude_py3.
...
traceback.print_stack doesn't have a stub yet. So ignore the
statement which uses it.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6bb266d262
bugdown's __init__.py: Add python 3 compatibility.
...
* Use Response.text instead of Response.content.
* Make unescaping work on python 3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
05046d9288
bugdown's codehilite.py: Fix annotations in python 3 mode.
...
Many stubs in xml.etree.ElementTree use Union[str, bytes] as
return type. Mypy wants us to correctly handle each case. This
is correct, but not useful for us since we know that we'll always
get str. So force the return value to text_type, to supress mypy
errors.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
610f19c791
zerver/lib/camo.py: Type ignore statement with hex encode.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
6a63870136
zerver/decorator.py: Correctly encode/decode strings.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
4e698ab1f6
Remove zerver/lib/parallel.py from mypy's exclude_py3.
2016-07-07 09:52:24 -07:00
Eklavya Sharma
ce6ddd574a
zerver/lib/test_helpers.py: Replace os.path.walk by os.walk.
...
os.path.walk has been removed in python 3.
2016-07-06 11:49:55 -07:00
Eklavya Sharma
6505cbf2bf
zerver/lib/timeout.py: Replace isAlive by is_alive.
...
In threading.Thread, isAlive has been removed in python 3.
We should use is_alive instead.
2016-07-06 11:49:48 -07:00
Eklavya Sharma
d8de54abe5
zerver/migrations: Squash an AlterField from 0002 into 0001.
...
Squash the AlterField on UserProfile.groups in 0002 into the
AddField in 0001. This is done to avoid a probable bug in Django,
where running migrations in python 3 sometimes led to a KeyError.
2016-07-06 11:40:12 -07:00
Umair Khan
47fb293f8a
i18n: Add English locale to language list if missing.
...
The English locale data is only present if the user has run `manage.py
makemigrations` on the system.
2016-07-06 11:34:28 -07:00
Eklavya Sharma
2d4dcd1698
Replace bytes by strings in zerver migrations 2, 13, 18.
2016-07-04 12:08:37 -07:00
Eklavya Sharma
6553e16b89
Replace bytes by strings in zerver/migrations/0001.
2016-07-04 12:08:37 -07:00
Umair Khan
035fceb814
Add dynamically loaded language dropdown.
2016-07-04 11:56:02 -07:00
Conrad Dean
bbf7a9c801
Annotate zerver/lib/event_queue.py.
2016-07-04 03:01:33 +05:30
Conrad Dean
9812e676f0
Annotate zerver/lib/queue.py.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
192663edcf
zerver/lib/narrow.py: Fix annotations.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
95b6e668a7
zerver/lib/actions.py: Fix annotations.
...
Change queue_ids from text_type to str.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
9772a512cb
Use abstract types in annotations.
2016-07-04 03:01:32 +05:30
Eklavya Sharma
fdf4d67cde
zerver/tornado.py: Convert queue_id to str.
2016-07-04 02:58:57 +05:30
Eklavya Sharma
de19b24f74
zerver/lib/handlers.py: Fix an annotation.
2016-07-04 02:20:25 +05:30
Eklavya Sharma
4761cc27dd
zerver/middleware.py: Fix annotations.
...
* Use abstract types where relevant.
* Fix string types.
* Fix annotation of args and kwargs.
2016-07-04 02:14:42 +05:30
Eklavya Sharma
6d8ba90db9
zerver/models.py: Modify imports for mypy in py3 mode.
...
Change 'from zerver.lib import bugdown' to
'import zerver.lib.bugdown as bugdown' to make zerver/models.py
pass mypy check in python 3 mode.
2016-07-02 10:38:48 -07:00
Eklavya Sharma
b902c1ae45
bugdown: Replace raw unicode literal with non-raw.
...
Raw unicode literals are disallowed in python 3.
2016-07-02 10:38:48 -07:00
Kartik Maji
f8bb7503e6
Add ability to pin streams to top of the streams sidebar list.
...
Based on work by Lauren Long, with some tweaks by tabbott.
2016-06-30 22:26:09 -07:00
Kartik Maji
a32167d921
test_events: Sort subscribers list.
...
The subscribers list is appended to in `peer_add` events with not
regard for preserving the ordering, and ordering isn't really
important here, so it seems best to just sort it in these checks.
2016-06-30 16:52:51 -07:00
Vishnu Ks
1cbd39b768
Unique link generator for realm creation.
2016-06-30 15:52:41 -07:00
Alex Wilson
8c62cff1b7
bugdown: Clean up paths to emojis.
2016-06-30 15:48:02 -07:00
Alex Wilson
b040839c76
Add unicode emoji to frontend markdown parser.
...
Fixes 2nd half of #1011 .
2016-06-30 15:48:02 -07:00
Alex Wilson
5ec29101eb
Add unicode emoji support to bugdown.
...
Fixes half of #1011 .
2016-06-30 15:48:02 -07:00
Tim Abbott
0397855fdd
test_hooks: Use send_json_payload for private message tests.
2016-06-30 15:12:03 -07:00
Rishi Gupta
17b6d136d5
Add Semaphore webhook integration.
2016-06-29 16:36:19 -07:00
Eklavya Sharma
def8cd8e78
Annotate zerver/lib/timeout.py.
2016-06-29 10:41:01 -07:00
Eklavya Sharma
21f789eb05
zerver/lib/session_user.py: Replace Dict by Mapping.
2016-06-29 10:36:50 -07:00
Eklavya Sharma
b76dc9bf4e
zerver/lib/upload.py: Fix string types.
2016-06-29 20:43:28 +05:30
Tim Abbott
abc2c03b0f
Fix missing 'current_url' value in registration flow.
...
This fixes some tracebacks I got while testing the Zulip htpasswd SSO
functionality.
I think that this stopped working as a result of the Jinja2 migration.
2016-06-28 23:05:38 -07:00
Tim Abbott
56e7a2f6f3
Annotate zerver.migrations.
2016-06-28 16:38:33 -07:00
Eklavya Sharma
2cba2caa7f
zerver/lib/test_helpers.py: Fix string annotations.
2016-06-29 01:54:17 +05:30
Eklavya Sharma
d9eb711e5e
zerver/tests/test_helpers.py: Use text_type for api_keys.
...
Also encode/decode strings appropriately when using api_keys to generate
basic auth header.
Also fix clashing annotations in zerver/tests/test_external.py.
2016-06-29 01:50:38 +05:30
Eklavya Sharma
eb3bde40a0
zerver/lib/test_helpers.py: Improve type annotations.
2016-06-29 01:35:34 +05:30
Eklavya Sharma
97760702a8
zerver/lib/actions.py: Use Sequence as parameter type.
2016-06-29 01:11:41 +05:30
Eklavya Sharma
dca9256f3c
zerver/lib/socket.py: Improve annotations.
...
* Add Optional where required.
* Set type of req_redis_key as `(text_type) -> text_type` for consistency.
Almost all our cache keys and redis keys use this signature.
2016-06-29 00:45:13 +05:30
Eklavya Sharma
b305af05b3
Fix string annotations in custom cursors.
2016-06-28 15:58:57 +05:30
Eklavya Sharma
1a00b08a11
zerver/lib/db.py: Use a type alias to shorten annotations.
2016-06-28 15:57:43 +05:30
acrefoot
acd7ff7aff
Fix typo in Recipient comment.
2016-06-27 18:34:02 -07:00
acrefoot
a36e5d4987
Add get_auth_backends endpoint to API.
...
We would like to know which kind of authentication backends the server
supports.
This is information you can get from /login, but not in a way easily
parseable by API apps (e.g. the Zulip mobile apps).
2016-06-27 18:30:34 -07:00
Tim Abbott
e72f41cdec
Remove old prototype data import/export tool.
...
This prototype from Dropbox Hack Week turned out to be too inefficient
to be used for realms with any significant amount of history, so we're
removing it.
It will be replaced by https://github.com/zulip/zulip/pull/673 .
2016-06-27 13:47:08 -07:00
Tim Abbott
b2a24e0306
Revert "Add authorization check before serving files."
...
This reverts commit e985b57259
.
This commit will break production when we next do a release, because
we haven't done a migration to create Attachment objects for
previously uploaded files.
2016-06-27 12:09:56 -07:00
Tim Abbott
f7e87bc1f0
test_helpers: Require that login calls actually succeed.
...
This caught several bugs where test code wasn't doing what it's author
intended.
2016-06-27 11:51:04 -07:00
Tim Abbott
4cac7bbb32
test_helpers: Refactor login test helpers.
...
We now have a separate login helper for the case where the return
value is desired.
2016-06-27 11:50:43 -07:00
Tim Abbott
a05c03d3b5
test_messages: Fix trying to login as a bot user.
...
Due to a recent refactoring, the first user in the subscribers list is
now a bot.
2016-06-27 11:48:39 -07:00
Tim Abbott
370b38696a
test_messages: Fix broken huddle messages test.
...
The second login call was failing because the user didn't exist.
2016-06-27 11:48:36 -07:00
rahuldeve
e985b57259
Add authorization check before serving files.
2016-06-27 11:24:35 -07:00
rahuldeve
674def30ee
Add support for serving files using API authentication.
...
Also remove 'get_uploaded_file' view function and the corresponding
old '/user_upload/' url pattern.
2016-06-27 11:00:41 -07:00
rahuldeve
2bf15603f3
Modify rest_dispatch to support method specific flags.
...
[simplified substantially by tabbott]
2016-06-27 10:53:15 -07:00
rahuldeve
823bf15c6e
Add API route for uploading files.
2016-06-27 10:30:58 -07:00
Tim Abbott
79570f99c2
json_upload_file: Remove unnecessary has_request_variables.
2016-06-27 10:29:30 -07:00
Tim Abbott
8272fb4a94
zerver.views.upload: Move upload functions later in file.
2016-06-27 10:28:09 -07:00
Eklavya Sharma
f20699b615
zerver/lib/statistics.py: Fix annotations.
...
Add type annotation to a variable.
Use abstract base container types where suitable.
Add missing imports from typing.
2016-06-27 18:03:29 +05:30
Eklavya Sharma
3917b822e5
zerver/lib/bulk_create.py: Type annotate variables.
2016-06-27 17:52:37 +05:30
Eklavya Sharma
d7a83ed019
zerver/views/__init__.py: Type annotate a variable.
2016-06-27 17:52:37 +05:30
Eklavya Sharma
63a5323259
zerver/views/streams.py: Type annotate variables.
2016-06-27 17:52:22 +05:30
Eklavya Sharma
9aa6fd988a
zerver/lib/actions.py: Type annotate variables.
2016-06-27 17:52:07 +05:30
Eklavya Sharma
7ca1e658b5
zerver/lib/cache.py: Change some TypeVars to Any.
...
Change ItemT and CompressedItemT to Any.
See https://github.com/python/mypy/issues/1721 .
2016-06-27 16:50:50 +05:30
rahuldeve
a3745178e5
Use django.utils.autoreload to restart queue workers at code change.
...
Fixes #621 , #1045 .
2016-06-26 20:12:11 -07:00
dhanus
1169329a71
Annotate zerver/views/webhooks/github.py.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
85cb3e6103
zerver/views/webhooks/github.py: Make exception string str.
...
Passing a unicode string to Exception can sometimes fail.
Convert it to str to prevent that.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
a32f83b182
zerver/views/webhooks/github.py: Fix string literals.
...
Change some string literals to unicode.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
fa4adf0c62
zerver/views/webhooks/bitbucket.py: Fix an annotation.
2016-06-26 08:13:49 -07:00
Eklavya Sharma
36c2214d94
zerver/views/webhooks/bitbucket.py: Fix string literals.
...
Convert some strings literals to unicode.
2016-06-26 08:13:49 -07:00
Max
9b6205d0ed
Annotate zerver/decorator.py.
2016-06-26 08:13:49 -07:00
Max
daab2ca475
zerver/tornadoviews.py: Improve an annotation.
...
Use django.core.handlers.base.BaseHandler instead of Any.
2016-06-26 19:05:54 +05:30
Tim Abbott
ce7c7d3510
Wrap youtube_re.
2016-06-25 10:52:03 -07:00
Tim Abbott
c25c8d8c98
forms: Wrap some very long lines.
2016-06-25 10:52:03 -07:00
Vishnu Ks
7d654a26c8
Casper test for realm creation.
2016-06-25 10:50:12 -07:00
Vishnu Ks
20adcbc64b
Make send_registration_completion_email return the Confirmation object.
2016-06-24 17:47:56 -07:00
Vishnu Ks
8350b89798
Add support for custom error message in realm-creation-failed template.
2016-06-24 17:47:56 -07:00
Tim Abbott
6d71c25a0f
accounts_register: Stop using _ as dummy variable.
...
This conflicts with internationalization.
2016-06-24 17:47:31 -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
acrefoot
5d21fb0681
Remove unused imports from tornadoviews.py.
2016-06-24 14:53:13 -07:00
acrefoot
be484b25c6
Add comments on how rest_dispatch authenticates.
2016-06-24 14:52:22 -07:00
Tomasz Kolek
e6861636c8
Fix editing messages by adding or removing leading /me.
...
Previously, this did not correctly rerender the message to be (or not
to be) rendered as a /me style message.
Fixes : #835 .
2016-06-24 11:18:29 -07:00
rahuldeve
8cecb37743
Modify Attachment model to track file access permissions.
2016-06-23 17:46:16 -07:00
Vishnu Ks
574a304b12
Mention invite emails are printed in console in dev.
...
This is part 2 of #1046 .
2016-06-23 17:07:11 -07:00
Umair Khan
33e6b471e2
Fix spelling of mesage_count_by_recipient_subject.
2016-06-22 09:02:35 -07:00
Tim Abbott
250781e843
Fix HTTP Basic Auth popups caused by auth failures.
...
If a user's session cookie expired, the next REST API request their
browser did would go into the json_unauthorized code path. This
returned a response with a WWW-Authenticate tag for HTTP Basic Auth
(since that's what the REST API uses), even for /json requests which
should only be authenticated using session auth.
We fix this by explicitly passing the desired WWW-Authenticate state.
Fixes : #800 .
2016-06-21 16:18:36 -07:00
Tim Abbott
45beac7d6c
test_decorators: Add test for /json/fetch_api_key.
2016-06-21 16:14:22 -07:00
Tim Abbott
f39c9161fe
Fix fetching user API keys via settings page when using LDAP backend.
...
Previously, json_fetch_api_key was hardcoding a check using Zulip's
built-in password functionality, rather than using authenticate().
2016-06-21 14:58:25 -07:00
Tomasz Kolek
7aa45ffa45
Increase send_message_backend coverage.
2016-06-21 14:33:21 -07:00
Tim Abbott
50f723f50b
Split test_narrow.py out of test_messages.py.
2016-06-21 12:25:08 -07:00
Tomasz Kolek
e3e03e2946
Add NarrowBuilder test cases.
...
Refactor existing add_term test cases.
2016-06-21 11:53:31 -07:00
Tomasz Kolek
f8c368c07f
Add default-bot during populate_db.
2016-06-21 11:47:38 -07:00
Tomasz Kolek
9ae68ade8b
Add is_webhook option to authentication decorats.
...
Modified:
authenticated_rest_api_view
authenticated_api_view and validate_api_key.
2016-06-21 11:47:38 -07:00
Tim Abbott
80d92c1651
Add comment documenting confusing list_to_streams code.
2016-06-21 11:45:35 -07:00
krtkmj
9dadab6eac
Replace placeholder variables x with more meaningful ones.
2016-06-20 19:36:07 -07:00
medullaskyline
e2eb4e0b7e
Annotate zerver/lib/email_mirror.py.
...
[With some fixes from @sharmaeklavya2].
2016-06-20 15:58:40 -07:00
Eklavya Sharma
a2668a2853
zerver/lib/notifications.py: Fix an annotation.
2016-06-21 02:20:36 +05:30
Umair Khan
134b165b1a
Fix frontend translation string bug.
...
The translation string which contain \n are not captured
within {{#tr}}{{/tr}} blocks. Fix is to escape the slash.
2016-06-20 11:31:28 -07:00
Vishnu Ks
ff66ce780a
Mention emails are printed in run-dev.py console.
...
Fixes : #1046
2016-06-20 11:07:20 -07:00
Eklavya Sharma
aceee3da11
zerver/lib/rate_limiter.py: Annotate rate_limiter.rules.
...
After annotating rate_limiter.rules, mypy complained that rules does
not support cmp. So use key to customize sort instead of cmp.
Python docs also recommend using key over cmp.
2016-06-18 16:41:41 -07:00
Eklavya Sharma
13f62da4ce
zerver/lib/rate_limiter.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
6097f6eed5
zerver/lib/initial_password.py: Encode return value.
...
zerver.lib.initial_password.initial_password is supposed to return an
Optional[text_type], but it returns an Optional[binary_type] instead.
Encode the return value to make sure it returns an Optional[text_type].
2016-06-18 16:41:40 -07:00
Eklavya Sharma
018041625c
zerver/lib/html_diff.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
68823767e2
zerver/lib/digest.py: Fix annotations.
2016-06-18 16:41:40 -07:00
Eklavya Sharma
64ccb390ff
Annotate zerver/lib/create_user.py.
2016-06-18 16:41:40 -07:00
Vishnu Ks
ad1c3894d9
Add interface for creating new realms.
...
This is controlled by settings.OPEN_REALM_CREATION; if that setting is
off, this feature doesn't do anything.
2016-06-17 16:15:28 -07:00
Vishnu Ks
8213ca135a
Move default_stream list to settings.
2016-06-17 16:01:38 -07:00
kunall17
007eee6061
Add route to fetch emails for mobile passwordless login.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android]
2016-06-17 11:03:19 -07:00
kunall17
7ea0eaed1c
Add passwordless login for mobile app development.
...
[Tweaked by tabbott to rename API to explicitly support not just
Android].
2016-06-17 10:58:33 -07:00
Vishnu Ks
01c9bb2d5e
Make name_changes_disabled() work with no argument.
2016-06-16 17:13:59 -07:00
Tomasz Kolek
76cbe89613
Add IFTTT integration.
2016-06-16 15:30:45 -07:00
Eklavya Sharma
598fb1ff28
zerver/lib/bugdown/fenced_code.py: Add BaseHandler.
...
Add a class 'BaseHandler' and make it a base class of OuterHandler,
QuoteHandler and CodeHandler. This will help annotate some functions
and improve type checking.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
142bcadb68
Annotate zerver/lib/bugdown/fenced_code.py.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
9b72b7b37e
Annotate zerver/lib/bugdown/codehilite.py.
...
Also change some string literals to unicode.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
744007f33f
zerver/lib/bugdown/__init__.py: Fix string types.
...
Change important string constants from str to text_type.
Replace str by text_type in annotations where relevant.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
04f44b12ad
zerver/lib/bugdown/testing_mocks.py: Fix types.
...
Also fix clashing annotations in zerver/lib/bugdown/__init__.py.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
7db0765a18
zerver/lib/bugdown/fenced_code.py: Fix types.
...
Change some important string literals from str to unicode.
Annotate format_code and codehilite_conf in FencedBlockProcessor.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
48c5b299b6
zerver/lib/bugdown/codehilite.py: Add type annotation.
...
Mypy incorrectly infers a dict's type as `Dict[str, List[object]]`.
Change that to `Dict[str, List[Any]]`.
2016-06-16 15:21:17 -07:00
Eklavya Sharma
a485d63975
zerver/lib/bugdown/__init__.py: Fix non-string annotations.
2016-06-16 15:21:17 -07:00
Tim Abbott
eafb91719c
get_tweet_id: Fix return type to by None.
2016-06-16 15:21:01 -07:00
Tim Abbott
33df0b29d3
Annotate zerver/tests/test_hooks.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
49ae0052b2
send_json_payload: payload arg can be text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
df9f89fe2c
test_helpers: Change send_json_payload to use text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
b14eacd552
test_helpers: Change fixture_data to text_type.
2016-06-16 14:07:34 -07:00
Tim Abbott
5b05644c95
Run mypy on zerver/tests/test_hooks.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
6723525fd3
Annotate zerver/tests/tests.py.
2016-06-16 14:07:34 -07:00
Tim Abbott
45883386ce
AlertWordTests: Cleanup confusing message variable reuse.
2016-06-16 13:55:58 -07:00
John Hergenroeder
16a19226f6
Add linter check for redundant REQ whence argument.
2016-06-16 13:53:39 -07:00
Eklavya Sharma
98553e8caa
zerver/lib/push_notifications.py: Fix strings.
...
Use appropriate string encode/decode operations and fix annotations.
2016-06-15 15:25:28 -07:00
Eklavya Sharma
78565a96c9
zerver/lib/notifications.py: Fix string annotations.
2016-06-15 15:25:28 -07:00
Tim Abbott
10dd9addb7
Fix ChangeSettingsTest caching issue causing test failures.
2016-06-15 14:57:58 -07:00
Tim Abbott
06079042d4
ChangeSettingsTest: Move login to test helper method.
2016-06-15 14:28:24 -07:00
Tim Abbott
8f67b7e498
Simplify check_for_toggle_param.
2016-06-15 14:23:51 -07:00
Ashish Kumar
0a98d9edcf
Add test_enter_sends_setting.
2016-06-15 14:23:51 -07:00
Ashish Kumar
8a55098ca7
Add test_time_setting.
2016-06-15 14:23:51 -07:00
Ashish Kumar
345df3538f
Add test_toggling_left_side_userlist.
2016-06-15 14:23:51 -07:00
Ashish Kumar
24767302c4
Update test_ui_settings to use new abstraction.
2016-06-15 14:23:51 -07:00
Ashish Kumar
006e528e18
Update test_notify_settings to use new abstraction.
2016-06-15 14:23:51 -07:00
Ashish Kumar
5ae06e8c33
Added test helper function: check_for_toggle_param
2016-06-15 14:18:55 -07:00
Tim Abbott
f88e5b7438
Add missing no-op migration for realm_emoji.
...
Because of how Django's migration system works, changing the error
message attached to a model field's validator results in an extra
migration.
2016-06-15 09:26:01 -07:00
Umair Khan
a976ccefbf
[third] Urlencode name of the uploaded file.
...
Update jquery-filedrop to send urlencoded filenames.
As discussed in https://github.com/zulip/zulip/pull/1023 , this fix is
already in jquery-filedrop upstream.
Fixes #981 .
2016-06-14 15:32:41 -07:00
Tomasz Kolek
4e51a86ea4
Add updownio integration.
2016-06-14 12:14:07 -07:00
Tomasz Kolek
14d69348d3
Add Airbrake integration.
2016-06-13 20:36:40 -07:00
Eklavya Sharma
72ed1f4187
Fix python 3 pyflakes error.
...
Change raw unicode literal to non-raw. A raw unicode literal is a
syntax error in python 3. This error was detected by pyflakes.
2016-06-13 19:44:56 -07:00
Tim Abbott
2219ef7bef
bugdown: Rename upload_re to upload_title_re for clarity.
2016-06-13 19:44:56 -07:00