Commit Graph

3777 Commits

Author SHA1 Message Date
Steve Howell d406d34fe0 Use user_id in admin_user_list.handlebars.
For our user administration, we now primarily work with user ids
that get put into data-user-id attributes.  We still put emails in the
tags to make our Casper tests easy to maintain.

This requires a minor change to the back end to pass down user ids
for the /users endpoint (in get_members_backend).
2017-02-14 23:07:44 -08:00
Umair Khan 6db4879f9c testing: Clear cache in queries_captured.
This results in a more deterministic result when we count queries.
2017-02-13 14:24:48 -08:00
Tim Abbott df7b10b7f2 test_runner: Hackishly fix broken failed status.
Something in c14e981e00 broken test
failures being reported properly; this isn't the right fix but works
and will let us avoid reverting the original change until it can be
fixed properly.
2017-02-11 23:02:47 -08:00
Tim Abbott 4060a97656 messages: Strip trailing whitespace in message contents.
I dug into why we never did this before, and it turns out we did, but
using `$.trim()` (which removes leading whitespace as well!).  When
removing the `$.trim()` usage.

Fixes #3294.
2017-02-11 23:01:22 -08:00
Robert Hönig 6ee845d027 Add html versions of the invite and signup mails
This commit adds html versions of the invite and signup mails and renames
the existing .txt files to the preferred file extensions '.subject', '.html'
and '.txt'. The html versions of the mails are being sent along with the
text-only versions by the 'send_confirmation' function.
This fixes #3134.
2017-02-11 17:08:57 -08:00
Tim Abbott 680d30adc2 docs: Add comments linking to new events doc. 2017-02-11 16:59:28 -08:00
Tommy Ip c7e33c6c9f optimization: Use Python to test management commands.
The original test was written in shell script which launches a new
django instance for every tests. By doing it in Python, we avoid
the overhead and reduce the test time to <1 second.

Fixes #3620.
2017-02-11 13:48:16 -08:00
Tim Abbott 46226bad21 presence: Fix mypy errors in new feature. 2017-02-10 23:57:28 -08:00
Tim Abbott eeca69cb4b mypy: Clean up more optional types. 2017-02-10 23:53:44 -08:00
Tim Abbott aee81b702c add_subscriptions_backend: Cleanup type of principals. 2017-02-10 23:53:44 -08:00
Tim Abbott c9a782ff75 Simplify zerver/views/users.py:get_stream_name. 2017-02-10 23:53:44 -08:00
Tim Abbott 2bba7755e3 decorator: Improve user agent parsing. 2017-02-10 23:53:44 -08:00
Tim Abbott bc63407e6a decorator: Cleanup api_key_legacy code readability. 2017-02-10 23:53:44 -08:00
Tim Abbott b81fd407e8 mypy: Fix several Optional typing errors. 2017-02-10 23:53:44 -08:00
Tim Abbott 6d00d4d2b1 mypy: Clean bugdown use of Optional. 2017-02-10 23:53:44 -08:00
Tim Abbott e746868375 mypy: Fix optional typing usage in rendering code path. 2017-02-10 23:53:44 -08:00
Tim Abbott 4e20b622ad bugdown: Remove unused height argument to add_a. 2017-02-10 23:53:44 -08:00
Tim Abbott 9f0c1db430 mypy: clean up strict optional errors in upload.py. 2017-02-10 23:53:44 -08:00
Tim Abbott 2140d2963d UserPresence: Cleanup confusing to_presence_dict arguments. 2017-02-10 23:53:44 -08:00
Tim Abbott 1c0f65cbec mypy: Fix some incorrect optional tags. 2017-02-10 23:53:44 -08:00
Tim Abbott bb5d81281c mypy: Upgrade to new package name and version 0.571.
Fixes #3448.
2017-02-10 23:53:44 -08:00
Tim Abbott 650469ead6 mypy: Make zerver/lib/ccache.py support python 3. 2017-02-10 23:53:44 -08:00
Tim Abbott 923f4ddd80 models: Remove nullable property from RealmAlias.realm. 2017-02-10 23:53:44 -08:00
Tim Abbott 71af0f7e2e Add endpoint to fetch presence data for a single user.
This is an experimental API subject to its data format being changed.

Fixes #3638.
2017-02-10 23:52:56 -08:00
Tim Abbott ac8b661a8f presence: Extract get_status_dicts_for_query. 2017-02-10 23:52:56 -08:00
saisrivathsa b867ac3496 Extract zerver/lib/events.py from actions.py with event registration.
This moves do_events_register, fetch_initial_state_data and friends to
a new file.

Modified significantly by tabbott for correctness and to remove unused
imports.

Fixes #3635.
2017-02-10 16:50:43 -08:00
Umair Khan c14e981e00 testing: Conform runner to Django architecture.
In Django, TestSuite can contain objects of type TestSuite as well
along with TestCases. This is why the run method of TestSuite is
responsible for iterating over items of TestSuite.

This also gives us access to result object which is used by unittest
to gather information about testcases.
2017-02-10 16:01:43 -08:00
Umair Khan e5a16ceb0a testing: Use failfast instead of fatal_errors.
`failfast` has the same meaning as `fatal_errors` in Django's test
runner.
2017-02-10 16:01:43 -08:00
Umair Khan 7743f74180 Do not append to INSTRMENTED_DATA directly.
Use append_instrumentation_data to append data to the INSTRUMENTED_DATA.
This gives us a layer of abstraction when we need to add instrumentation
data from other modules e.g. while running tests in parallel mode.
2017-02-10 16:01:43 -08:00
Umair Khan 78768a2ba9 Add process_instrumentation_data function.
This function can be used to perform processing on instrumentation data.
For example, this can be used to send the instrumentation data gathered
in the test suite running in the child process to the parent process for
aggregation.
2017-02-10 16:01:43 -08:00
Umair Khan 00f8239563 Clean code of send_test_email command.
* Derive from sendtestemail command of Django.
* Remove unwanted imported.
* Allow test email to admin and managers.
2017-02-10 16:01:43 -08:00
Umair Khan ef0d2a4bb5 logging: Use django.server to filter 200 and 304.
Previously, we were monkey patching the runserver command
in zerver/management/commands/rundjango.py for this.
2017-02-10 15:55:17 -08:00
Brock Whittaker 1143ed7219 redesign: Change /#settings and /#administration to an overlay.
This also adds a box-shadow to the #deactivate_self_modal so that it
looks similar to the old backdrop.
2017-02-09 23:35:10 -08:00
Harshit Bansal 8ae54ddb99 actions.py: `restricted_to_domain` should be False if there are no aliases.
Having `restricted_to_domain` set to True if there are no more aliases
left means the user is either confused or forgot to set it to False. It
should be set to False automatically when the last alias is deleted.
2017-02-08 22:14:43 -08:00
Harshit Bansal 7d10cbc32b Add RealmAlias.allow_subdomains to model, frontend, and API.
Includes a database migration.

Fixes #1868.
2017-02-08 22:03:27 -08:00
Rishi Gupta a16c48f0c4 actions.py: Change do_remove_realm_alias to take a RealmAlias.
Ensures that this function doesn't throw an error / prevents putting in an
incorrect realm or domain argument.
2017-02-08 21:15:28 -08:00
Tim Abbott 0c363dffca lint: Ban use of deprecated assertEquals. 2017-02-08 16:38:43 -08:00
Umair Khan c585fa6eb4 change-email: Delete display recipient cache. 2017-02-07 21:49:31 -08:00
Tim Abbott 84b18f865a users: Verify full names explicitly in account registration.
I believe this completes the project of ensuring that our recent work
on limiting what characters can appears in users' full names covers
the entire codebase.
2017-02-07 20:20:32 -08:00
Tim Abbott 56cecc4891 users: Verify full names explicitly in user creation.
This fixes an issue where users could be created with an invalid name
(introduced only a couple commits ago when we added character set
restrictions).
2017-02-07 19:54:30 -08:00
Tim Abbott 2283b5fc91 users: Consolidate name change enforcement logic.
This has the side effect of fixing an issue where one could edit a
bot to have an invalid name.
2017-02-07 19:45:21 -08:00
Ritwik Srinivas 74b68f6bbc Adds banned characters in name function
Disallows you from putting the characters @, *, `, and > and " in
your name. Added test cases similar to the MAX_NAME_LENGTH check

Copied initial code from:
https://github.com/zulip/zulip/pull/2473
2017-02-07 19:31:14 -08:00
Jackson dcca54e8a9 integrations: Add Greenhouse integration. 2017-02-07 19:08:35 -08:00
Umair Khan 41aa07adb6 change-email: Delete email caches on email change. 2017-02-07 18:43:26 -08:00
Feorlen 676f0ad63f Add WordPress webhook.
Adds a new webhook integration for WordPress blogs. Both WordPress.com
and self-installed blogs are supported, with minor differences that
are described in the documentation. It creates a new message for each
action, the stream and topic may be specified or use default values.

WordPress actions supported:

publish_post:  a new blog post was published
publish_page:  a new page was published
user_register: a new user account was created
wp_login:      a user logged in

Notes: comment_post only provides the id of the parent post, not title
or link, so was not included. On further testing, I found edit_post is
not very practical, it also fires while a new post is being written, and
when posts are deleted. (I think it tracks drafts too.) I've removed it,
as it seems more confusing than useful.

Fixes #3245
2017-02-07 18:14:31 -08:00
Tim Abbott 20096dfe0d lint: fix PEP8 issue with logging_handlers.py. 2017-02-07 13:22:01 -08:00
Tim Abbott f79bced276 logging: Fix recursive exceptions with too large files.
This resolves another new exception in Django 1.10 that now can happen
in our error reporting code path.
2017-02-07 12:28:54 -08:00
Eklavya Sharma dd0e1f6a4c Use correct string type in boto function parameters.
boto's stubs have been updated in mypy 0.4.7, which has given us
more information about what type of strings are expected as
parameters in various functions.
2017-02-06 22:37:37 -08:00
Eklavya Sharma 415ce9c312 zerver/lib/test_helpers.py: Wrap function in lambda.
Wrap `list.append` in a lambda before assigning it to
event_queue.process_notification to prevent errors when
event_queue.process_notification is used with keyword arguments.

This also removes an error message by mypy 0.4.7.
2017-02-06 22:35:35 -08:00
Eklavya Sharma b7635db1e4 Replace 'type' with 'Type[BaseException]'.
This strengthens type checking and helps switch over to mypy 0.4.7.
2017-02-06 22:34:01 -08:00