Commit Graph

4360 Commits

Author SHA1 Message Date
K.Kanakhin 18f2a7428f Fix missing aggregated info in real-time sync race for presence.
- Add aggregated info to real-time updated presence status.
- Update `presence events` test case with adding aggregated
  information to presence event.
- Add test case for updating presence status for user which
  send state from multiple clients.

Fixes #4282.
2017-04-26 13:20:22 -07:00
Umair Khan ce5980aa45 testing: Don't destroy template DB in parallel mode. 2017-04-26 13:59:42 +05:00
Tim Abbott c4716aefc7 mypy: Move `type: ignore` check to the line with the error.
Fixes https://travis-ci.org/zulip/zulip/jobs/225841310

I'm pretty sure the fact that I need to do this is a mypy bug.
2017-04-25 23:44:41 -07:00
Tim Abbott cb6373210b logging_handlers: Fix tracebacks being emailed in subject lines.
Some exceptions happening in queue processors were being incorrectly
emailed out in the subject line, rather than the body, of the error
report.
2017-04-25 18:55:11 -07:00
Tim Abbott c0d7e83333 logging: Change missing push notification keys from error to warning.
This is a configuration problem, but it just means a feature is not
enabled, not that attention is required, so it should be a warning,
not an error.
2017-04-25 13:52:36 -07:00
Tim Abbott b6094b8e91 logging_handlers: Fix missing host key in queue errors.
This fixes exceptions thrown when trying to report errors from queue
processors to email.
2017-04-25 13:48:44 -07:00
Eeshan Garg 46b6475066 webhooks/gitlab: Use branches.find to filter Git notifications. 2017-04-25 10:46:21 -07:00
Eeshan Garg 8900e99ae5 github_webhook: Use branches.find to filter Git notifications. 2017-04-25 10:46:21 -07:00
Maxim Averin 15170b5423 Switch regenerate_api_key to use RealmAuditLog. 2017-04-25 10:23:33 -07:00
Umair Khan 86ebc2ccb1 testing: Reset INSTRUMENTED_CALLS for subsuites.
We need to reset INSTRUMENTED_CALLS variable before running every
subsuite. If we do not do this then the subsuite running on a
particular process called A will send the accumulated instrumented
calls gathered by the previous subsuites which also ran on the process A.

This also fixes the extra delay that we used to experience after the
tests had finished running. The extra delay was due to the duplicate
instrumented calls in the INSTRUMENTED_CALLS list. The size of this
list used to be ~100k for parallel model as opposed to ~1800 for serial
model.
2017-04-25 09:07:15 -07:00
Umair Khan d4ca0f1751 testing: Create one upload directory per process.
This commit creates a dedicated file upload directory for every process
when we are running tests in parallel mode. This makes sure that we do
not run into any race conditions due to multiple processes accessing
the same upload directory.
2017-04-25 09:07:15 -07:00
Umair Khan 93b4200cae testing: Move _worker_id incrementer block to the top.
Incrementing the _worker_id should be the first step for the process.
It gives better structure to the code.
2017-04-25 09:07:15 -07:00
Tim Abbott 427629ca4c emoji: Fix strings in migration 0076.
It's arguably a bug that Django puts the value strings into the
migration object, but this was causing test failures.
2017-04-24 22:50:19 -07:00
Cynthia Lin ef2ff9f9a0 integrations: Remove deprecated Stash integration. 2017-04-24 22:35:23 -07:00
Harshit Bansal 07081196f4 backend: Allow to change UserProfile's `emojiset` field via api. 2017-04-24 22:30:07 -07:00
Harshit Bansal fb3fda031d models: Add `emojiset` field to `UserProfile` model.
Includes a database migration.
2017-04-24 22:30:06 -07:00
Tim Abbott 1f0c4e5fb3 email mirror: Fix mypy annotation error. 2017-04-24 22:01:48 -07:00
Umair Khan 556264f3d7 reset_password: Modify password reset email if email is in wrong realm.
This fixes a confusing issue where a user might try resetting the
password for an email account that in part of a different Zulip
organization.

Is a useful early step towards making Zulip support reusing an email
in multiple realms.

Fixes: #4557.
2017-04-24 21:58:29 -07:00
K.Kanakhin e3e52e7284 email-mirror: Move postfix email mirror integration to separate script.
This fixes a performance problem where we were previously starting up
a full Django process (~0.7s even on a fast machine) every time a new
email came in, potentially allowing users to accidentally DoS a Zulip
server.  Now, we just post over HTTPS, allowing the existing thread
pool support to do its job.

- Add script wrapper to communicate postfix pipe with django web server
  over HTTP(S). It uses shared_secret authentication mode.
- Add django view to process messages from email mirror server.
- Clean management command `email-mirror`. Left just functional
  for cron email processing.
- Add routes for new tornado view.
- Change pipe script in master process postfix config template
  based on updated script.
- Add tests.

Tweaked by tabbott to adjust the directory and set better defaults.

Fixes #2421.
2017-04-24 21:24:23 -07:00
Maxim Averin 73a1dd63d5 analytics: Refactor legacy 'zulip_internal' decorator.
Rename 'zulip_internal' decorator to 'require_server_admin', add
documentation for 'server_admin', explaining how to give permission
for ./activity page.

Fixes: #1463.
2017-04-22 11:42:02 -07:00
Eeshan Garg ce0f1453b9 webhooks: Filter specific BitBucket Git branches.
This is the last of the Git integrations that didn't have this
feature.

Fixes #4327.
2017-04-22 11:29:53 -07:00
Michael 854d70e7c6 test_events: Verify format of event dicts precisely.
This is basically just using the new check_dict_only everywhere, with
a few exceptions:
* New self.check_events_dict automatically adds the id field to avoid
  duplicating it ~80 times.
* Set log=False for many of the testing action functions to remove the
  timestamp field from their returned event dictionaries, since it's
  not needed and is the result of a deprecated log_event function.

Wasn't sure if the subscription_field list in do_test_subscribe_events
could contain optional arguments, so I left the call to check_dict on
along with a TODO.

Fixes: #1370.
2017-04-22 11:22:41 -07:00
Aditya Bansal bdcddd35d0 tests: Add wrapper for client.logout in ZulipTestCase.
In this commit we add a logout wrapper so as to enable developers
to just do self.logout instead of doing a post request at API
endpoint for logout. This is achieved by adding a wrapper function
for the Django's client.logout contained in TestCase. We add this
by extending ZulipTestCase to have a logout function.
2017-04-21 21:45:55 -07:00
Eeshan Garg 55e1154871 webhooks/beanstalk: Filter specific Git branches. 2017-04-21 22:06:11 -02:30
Eeshan Garg dded73ec6f webhooks: Stop overriding build_webhook_url for URL query parameters. 2017-04-21 22:06:11 -02:30
Eeshan Garg e68b957f3d webhooks/gogs: Filter specific Gogs branches. 2017-04-21 22:06:11 -02:30
Tim Abbott e7974b3b65 git: Fix nondeterministic ordering of commit authors.
This should fix the nondeterministic test failures introduced by
e7455e276b.
2017-04-21 11:45:30 -07:00
Siddharth Mahapatra e7455e276b git integrations: Expand details in commit push notifications.
We now show a few new things:
(1) The number of commits pushed.
(2) Who authored the commits (just counts, not which specific ones, for brevity).

Add tests for case of multiple committers.

Part of #3968.
2017-04-21 11:07:44 -07:00
Tim Abbott 1cfebdcb84 forms: Fix minor pep-8 lint error. 2017-04-20 11:39:19 -07:00
Umair Khan dbbc73837d redirect_to_main_site: Handle is_signup parameter.
Passes on the is_signup parameter passed in a querystring.
2017-04-20 11:14:28 -07:00
Umair Khan 8b88cfc84b redirect_and_log_into_subdomain: Handle is_signup. 2017-04-20 11:11:54 -07:00
Umair Khan 4ab783134e testing: Move unsign_subdomain_cookie to test_helpers.
We'll be using it in other files soon.
2017-04-20 11:10:56 -07:00
Umair Khan 8fee31f7ff forms.py: Include email in the error messages. 2017-04-20 11:07:01 -07:00
Umair Khan 1d9113d326 forms.py: Use .format() for string formatting. 2017-04-20 10:28:05 -07:00
Sarah 81f76ff13b Realm.py: Removing 'exclude' variable.
The exclude variable was superfluous. The realm properties
listed in the exclude variable are not in the
realm.property_types dict, so they do not need to
be explicitly excluded.
2017-04-19 22:08:36 -07:00
Sarah 95ff65b290 zerver/lib/events: Refactor fetch_initial_state_data.
This Refactors the function fetch_initial_state_data to use the
realm.property_types attribute, avoiding some unnecessary code
duplication.

Tweaked slightly by tabbott to simplify the code a bit.

Addresses part of issue #3854.
2017-04-19 22:08:03 -07:00
Tim Abbott 55bea73035 Revert "github: Call the appropriate authenticate."
This reverts commit ab260731a9.

The overridden authenticate method was buggy.
2017-04-19 10:06:00 -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 ae788b2e98 zilencer: Remove decorators Deployment code. 2017-04-18 23:00:10 -07:00
Tim Abbott cd89fbc0a9 models: Extract AbstractPushDeviceToken. 2017-04-18 23:00:10 -07:00
Umair Khan 8f5dfffe39 testing: Fix test_update_invalid_value.
This test was using hardcoded field id which made it order dependent.
2017-04-18 21:46:14 -07:00
Jacob Hurwitz 8343d80873 Fix mobile home view returning messages older than the pointer.
In cases where old unread messages in the home view might have been
leaked (either due to bugs or unusual muting interactions), it's
theoretically possible for the first unread message in the home view
to be far older than the pointer.

Since the Zulip mobile app is loading messages following the
use_first_unread logic, we need to plug this gap.

Probably a longer-term solution will involve changing how
update_message_flags works to automatically advance the pointer, but
this change should make it possible for the mobile apps to
consistently use the `use_first_unread` mechanism for fetching the
latest home view messages.

With tweaks to the tests by tabbott.

Fixes zulip/zulip-mobile#422.
2017-04-18 21:39:24 -07:00
Tim Abbott a543b3cacd attachment: Clarify and test logic for invalid uploads. 2017-04-18 21:27:29 -07:00
Tim Abbott e90748348b attachment: Remove unused claim_attachment return value. 2017-04-18 21:27:29 -07:00
Tim Abbott 568b59291b attachment: Improve rules for managing attachment ownership.
The previous logic was that anyone with a link to a file could send it
to other users, but only the owner could make a file realm-public.
This had some confusing corner cases.

The new logic is much simpler:
* Only the file's owner/uploader can include a file in a message for
  the first time.
* Anyone with access to read a file can share it with others by
  including it in messages they send.
* Once a file has been sent to a public stream, any user in the realm
  can access it.
2017-04-18 21:27:29 -07:00
Tim Abbott b92385ea8e attachment: Make path_id field unique.
This will help avoid future bugs similar to that fixed in migration
0072.
2017-04-18 21:27:28 -07:00
Tim Abbott 0f855b84cc attachment: Add migration to fix duplicate attachment objects.
The comment in the migration explains this change in detail.
2017-04-18 21:27:27 -07:00
Aditya Bansal 08e4a67fa5 tests: Fix occasionally breaking tests.
In this commit we fix the occasionally breaking tests for
test_home.HomeTest.test_bad_narrow which were the result of
us patching global settings in test_upload to add some new emails
to CROSS_REALM_BOT_EMAILS and not rolling back.
2017-04-18 19:44:12 -07:00
Abhijeet Kaur 5e55fe992d backend: Add ability to search by group private message thread.
This doesn't yet contain the frontend or documentation for this
feature.

Modified by tabbott to rename the parameter and line-wrap the query
code.
2017-04-18 15:50:27 -07:00
Umair Khan cf3b6c6ca9 profile: Support custom profile data.
Implements backend for #1760.
2017-04-18 15:20:59 -07:00