Tim Abbott
375551aaa6
Clean up most hardcoding of mit.edu domain checks.
...
This moves all this code to be gated on a few virtual realm settings.
2016-07-26 20:30:12 -07:00
Tim Abbott
70543e059a
bugdown: Remove hardcoding of mit.edu for zephyr_mirror realm config.
2016-07-26 20:30:12 -07:00
Tim Abbott
c17676b00c
Cleanup MIT hardcoding for disabling presence.
2016-07-26 20:30:12 -07:00
Tim Abbott
884f50cdd7
validate_user_access: Assert user_profile is not None.
...
This function is only called in cases where user_profile isn't None,
and the code reads better if we just check that first rather than
checking it on every line that accesses user_profile.
2016-07-26 20:30:12 -07:00
Tim Abbott
d1adbd798b
get_subscribers_to_streams: Pass through requesting_user.
2016-07-26 20:30:12 -07:00
Tim Abbott
691ad7fcfc
maybe_get_subscriber_emails: Pass user_profile through.
2016-07-26 20:30:12 -07:00
Tim Abbott
f790a04102
Remove unused get_subscriber_ids.
2016-07-26 20:30:12 -07:00
Tim Abbott
1771b8275c
Remove unused get_other_subscriber_ids.
2016-07-26 20:30:12 -07:00
rahuldeve
5ed2b01bc7
upload: Fix single attachments not being claimed on message edit.
...
Fixed an attachments not being claimed if just one new attachment is
added (aka the common case).
2016-07-25 17:56:27 -07:00
rahuldeve
e06d5fbec9
Pass Message object instead of message dict to do_claim_attachments.
2016-07-25 17:54:36 -07:00
rahuldeve
c61d149837
Pass Message object instead of message dict to claim_attachment.
2016-07-25 17:51:17 -07:00
Eklavya Sharma
5b06edc402
zerver/lib/type_debug.py: Handle container types better.
2016-07-23 14:35:39 -07:00
Eklavya Sharma
a632c71cce
Add zerver/lib/type_debug.py.
...
This file has a decorator print_types, which makes the decorated
function print the types of its arguments whenever it is called.
2016-07-23 14:35:39 -07:00
Tim Abbott
eba2d470dc
Fix removing attachments when editing a message.
...
Fixes #1373 .
2016-07-22 14:48:47 -07:00
Eklavya Sharma
674f6999e1
Improve annotations of decorators.
2016-07-22 11:14:33 -07:00
Eklavya Sharma
07e36d87a2
Remove return where no return value is expected.
...
zerver.lib.notifications.send_future_email has return type None.
So replace `return send_future_email(...` by `send_future_email(...`.
2016-07-22 11:14:33 -07:00
Krit Karan
a61ef3bc0e
Reformat the content variable in ``do_refer_friend()``.
...
Fixes #1162 .
2016-07-22 10:36:35 -07:00
Eklavya Sharma
c59740385d
zerver/lib/str_utils.py: Replace ValueError by TypeError.
...
When a parameter of a wrong type is passed to a `force_*` method
in str_utils.py, raise a TypeError.
2016-07-21 23:14:00 +05:30
Tim Abbott
c791037166
narrow: Document BuildNarrowFilterTest.
2016-07-20 14:18:40 -07:00
Tim Abbott
e876f12b83
settings: Extract settings.WELCOME_EMAIL_SENDER.
2016-07-19 15:28:41 -07:00
Tim Abbott
7725c62892
Use VERBOSE_SUPPORT_OFFERS in day1 emails.
2016-07-19 15:28:41 -07:00
Tim Abbott
3ea4cbb5c3
settings: Extract settings.VERBOSE_SUPPORT_OFFERS.
2016-07-19 15:28:41 -07:00
Tim Abbott
ff1faffecd
settings: Extract EMAIL_GATEWAY_EXTRA_PATTERN_HACK.
2016-07-19 15:28:41 -07:00
Tim Abbott
afaac85dc6
Move get_sqlalchemy_connection to its own file.
2016-07-19 15:28:41 -07:00
Kartik Maji
599b15cb84
Allow fetching subscribers for streams the user has never subscribed to.
...
This allows the frontend to fetch data on the subscribers list (etc.)
for streams where the user has never been subscribed, making it
possible to implement UI showing details like subscribe counts on the
subscriptions page.
This is likely a performance regression for very large teams with
large numbers of streams; we'll want to do some testing to determine
the impact (and thus whether we should make this feature only fully
enabled for larger realms).
2016-07-18 16:24:19 -07:00
Taranjeet Singh
9f3f82d06d
zerver/lib/socket.py: Fix line with length greater than 120.
2016-07-18 14:42:39 -07:00
Tim Abbott
014a13df7c
cache: Fix echoing of mkdir command to console.
2016-07-18 14:25:13 -07:00
Taranjeet Singh
ba3f9de9a9
zerver/lib/cache.py: Move remote_cache_prefix to var directory.
...
This commit ensures the var directory exists before its needed in both
development and production environments.
2016-07-18 14:13:02 -07:00
Eklavya Sharma
c389d22b5f
Fix twitter mock data.
2016-07-17 10:23:25 -07:00
Eklavya Sharma
fb1d00fc6c
Upgrade python-twitter to latest version.
...
Fixes #1145 .
2016-07-17 10:23:25 -07:00
Eklavya Sharma
4130170da8
bugdown: Fix string handling.
...
Use unicode strings where needed and correctly encode/decode strings.
2016-07-17 10:23:25 -07:00
Eklavya Sharma
abe7faa2f9
bugdown: Annotate some variables.
2016-07-17 10:23:25 -07:00
Steve Howell
60bd20da61
Remove zerver/lib/query.py (dead code).
2016-07-16 14:51:15 -07:00
Rishi Gupta
09754c9861
Remove JsonableErrors from actions.do_update_message.
...
There were a bunch of authorization and well-formedness checks in
zerver.lib.actions.do_update_message that I moved to
zerver.views.messages.update_message_backend.
Reason: by convention, functions in actions.py complete their actions;
error checking should be done outside the file when possible.
Fixes : #1150 .
2016-07-15 13:55:49 -07:00
Rishi Gupta
d529a94e4d
Add realm setting to time-limit editing of message content.
...
This is controlled through the admin tab and a new field in the Realms table.
Notes:
* The admin tab setting takes a value in minutes, whereas the backend stores it
in seconds.
* This setting is unused when allow_message_editing is false.
* There is some generosity in how the limit is enforced. For instance, if the
user sees the hovering edit button, we ensure they have at least 5 seconds to
click it, and if the user gets to the message edit form, we ensure they have
at least 10 seconds to make the edit, by relaxing the limit.
* This commit also includes a countdown timer in the message edit form.
Resolves #903 .
2016-07-15 13:55:49 -07:00
Eklavya Sharma
29673411df
Make backend tests (hackishly) pass on python3.4.
...
Replace bot_owner=bot_owner by bot_owner_id=bot_owner.id while
creating a UserProfile object.
2016-07-15 11:13:33 -07:00
Steve Howell
9d7716f368
Add message.topic_name() helper function.
...
This little helper will facilitate adding a new Topic
table in the future.
2016-07-14 09:54:56 -07:00
Steve Howell
21fb7693d2
Add test_helpers.client_patch_multipart().
2016-07-13 22:53:40 -07:00
Steve Howell
701bb7a59f
Remove test_helpers.DummySession
2016-07-13 19:08:28 -07:00
Steve Howell
616e49e2e8
Remove test_helpers.DummyTornadoRequest
2016-07-13 19:08:28 -07:00
Steve Howell
0060ea7903
Remove test_helpers.DummyStream
2016-07-13 19:08:28 -07:00
Steve Howell
191ac80475
Remove callback logic from test_helpers.DummyHandler.
2016-07-13 19:08:28 -07:00
Eklavya Sharma
4f633bcd0b
zerver/lib/notifications.py: Fix string encoding/decoding.
...
Correctly encode and decode strings in convert_html_to_markdown.
It wasn't possible to use universal_newlines=True since
Popen.communicate doesn't encode/decode strings correctly on
python 2.
2016-07-13 16:00:46 -07:00
Eklavya Sharma
e6502710b6
Change exception.message to str(exception).
...
The 'message' attribute in Exception has been deprecated.
It has been removed in python 3.
2016-07-13 16:00:46 -07:00
Eklavya Sharma
993558c680
Get mogrified SQL queries as text.
...
zerver.lib.test_helpers.queries_captured returns a byte string,
while we want the queries to be text. So decode the captured
queries.
2016-07-13 16:00:46 -07:00
Umair Khan
395e053ce3
Revert "Revert "Extract reply from email.""
...
This reverts commit f1ba3ded42
.
2016-07-13 11:24:18 -07:00
Umair Khan
f15dfc69fb
Make code Python 3 compatible.
...
Make convert_html_to_markdown function Python 3 compatible.
2016-07-13 11:24:18 -07:00
Tim Abbott
34a251adb1
upload: Fix exception uploaded files with unknown content type.
...
It turns out our detected content_type can actually be None, which
meant calling force_text on it broke uploading some files.
2016-07-13 10:57:55 -07:00
Umair Khan
0aae0eab49
Switch to PyAPNS for sending push notifications.
...
Switch to [PyAPNS](https://github.com/djacobs/PyAPNs ).
Fixes #538 .
2016-07-13 10:55:07 -07:00
Tim Abbott
305189956b
update_message_flags: Log number of messages updated.
2016-07-12 19:12:49 -07:00