Commit Graph

261 Commits

Author SHA1 Message Date
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
Tim Abbott b5e92f541a Add new documentation on Zulip settings system.
Fixes: #962.
2016-06-17 12:15:15 -07:00
Tim Abbott 6d1d7471e6 Refactor out zproject/dev_settings.py. 2016-06-17 12:15:15 -07:00
Tim Abbott 02e6d267f1 [third] Replace jquery-caret with newer implementation.
Apparently, there are like 5 independently developed jquery-caret
plugins, none of which are great.  The previous one we were using was
last modified in 2010.  This new one comes from
https://github.com/acdvorak/jquery.caret and at least doesn't use
deprecated jQuery syntax and has a repository on GitHub.

This plugin is way larger than it needs to be for what it does, but we
can deal with that later.
2016-06-14 16:36:51 -07:00
Tim Abbott 44929523d6 Harden extraction of AUTH_LDAP_BIND_PASSWORD. 2016-05-31 15:06:43 -07:00
Tim Abbott dac8f7d923 Fix buggy extraction of EMAIL_GATEWAY_PASSWORD.
EMAIL_GATEWAY_PASSWORD has a value of None in the defaults list, so it
will never fail to be in vars().
2016-05-31 15:06:17 -07:00
Umair Khan daf3d51d4b Send 'template_rendered' signal from Jinja2.
Send the signal only under DEBUG=True just like Django.
2016-05-31 14:31:13 +05:00
Tomasz Kolek ff4e92dc3d settings: change tab indentation to space. 2016-05-30 20:16:00 -07:00
Umair Khan 82b5d9304b [third] Integrate i18next with Handlebars 2016-05-19 22:58:25 -07:00
Vishnu Ks 425363ced4 Fix non determinism bug in casper tests.
This manifested as "ReferenceError: Can't find variable: message_list"
on random tests in the Casper test suite.
2016-05-19 08:27:46 -07:00
Tim Abbott b869be9301 style: Use 'not in' consistently rather than `not foo in`. 2016-05-09 17:00:10 -07:00
Tim Abbott 9cf18f8535 settings: Fix whitespace errors. 2016-05-09 16:53:12 -07:00
Umair Khan 5359e6b0d4 Convert Zulip to use Jinja2 templates.
This results in a substantial performance improvement for all of
Zulip's backend templates.

Changes in templates:
- Change `block.super` to `super()`.
- Remove `load` tag because Jinja2 doesn't support it.
- Use `minified_js()|safe` instead of `{% minified_js %}`.
- Use `compressed_css()|safe` instead of `{% compressed_css %}`.
- `forloop.first` -> `loop.first`.
- Use `{{ csrf_input }}` instead of `{% csrf_token %}`.
- Use `{# ... #}` instead of `{% comment %}`.
- Use `url()` instead of `{% url %}`.
- Use `_()` instead of `{% trans %}` because in Jinja `trans` is a block tag.
- Use `{% trans %}` instead of `{% blocktrans %}`.
- Use `{% raw %}` instead of `{% verbatim %}`.

Changes in tools:
- Check for `trans` block in `check-templates` instead of `blocktrans`

Changes in backend:
- Create custom `render_to_response` function which takes `request` objects
  instead of `RequestContext` object. There are two reasons to do this:
    1. `RequestContext` is not compatible with Jinja2
    2. `RequestContext` in `render_to_response` is deprecated.
- Add Jinja2 related support files in zproject/jinja2 directory. It
  includes a custom backend and a template renderer, compressors for js
  and css and Jinja2 environment handler.
- Enable `slugify` and `pluralize` filters in Jinja2 environment.

Fixes #620.
2016-05-09 09:55:18 -07:00
Tim Abbott c0d38f42f1 supervisor: Use 127.0.0.1 rather than localhost for tornado.
In theory these should be the same, but in misconfigured environments
(such at Travis CI) where /etc/hosts has multiple entries for
"localhost", 127.0.0.1 is safer than "localhost".
2016-05-08 17:35:50 -07:00
Tim Abbott 73b3f7a26e settings: Fix new-style template LOADERS syntax. 2016-05-07 19:35:16 -07:00
Umair Khan 4620cd8483 settings: Migrate template settings to using TEMPLATES.
This is cleaner and also is necessary preparation for supporting
Jinja2.
2016-05-07 17:29:51 -07:00
Umair Khan a3acd5e8e9 settings: Add LocaleMiddleware to MIDDLEWARE_CLASSES.
This is needed for internationalization.
2016-05-07 17:00:10 -07:00
Tim Abbott 52c1e8ac7d Run a local camo server in voyager production environments.
Camo is a caching image proxy, used in Zulip to avoid mixed-content
warnings by proxying HTTP image content over HTTPS.  We've been using
it in zulip.com production for years; this change makes it available
in standalone Zulip deployments.
2016-05-02 17:21:31 -07:00
Tim Abbott c83999fe52 Fix EXTRA_INSTALLED_APPS in development.
In theory, tools like populate_db should probably be in zerver, not
zilencer, but until we migrate them out, we need to include these in
EXTRA_INSTALLED_APPS in development.
2016-04-26 21:55:31 -07:00
Tim Abbott 2b30b670e0 Factor out EXTRA_INSTALLED_APPS setting. 2016-04-26 21:28:51 -07:00
Tim Abbott 49799440a4 Replace use of django-guardian with fields on UserProfile.
As documented in https://github.com/zulip/zulip/issues/441, Guardian
has quite poor performance, and in fact almost 50% of the time spent
running the Zulip backend test suite on my laptop was inside Guardian.

As part of this migration, we also clean up the old API_SUPER_USERS
variable used to mark EMAIL_GATEWAY_BOT as an API super user; now that
permission is managed entirely via the database.

When rebasing past this commit, developers will need to do a
`manage.py migrate` in order to apply the migration changes before the
server will run again.

We can't yet remove Guardian from INSTALLED_APPS, requirements.txt,
etc. in this release, because otherwise the reverse migration won't
work.

Fixes #441.
2016-04-20 21:51:52 -07:00
Tim Abbott 74abd47684 Fix EMAIL_GATEWAY_BOT not being set by default in production.
Previously the DEFAULTS value of None for EMAIL_GATEWAY_BOT was
overriding the initialization code.
2016-04-13 13:19:02 -07:00
Vishnu Ks 35f70e9dac Move 5 legacy global variables to pointer.js.
Move recenter_pointer_on_display, suppress_scroll_pointer_update,
fast_forward_pointer, furthest_read, and server_furthest_read to
a new pointer module in pointer.js.
2016-04-12 10:56:54 -07:00
Tim Abbott e9637a545f Rename zerver.handlers to zerver.logging_handlers for clarity. 2016-03-30 21:48:38 -07:00
goelakash 25a75bcefe Change LOCAL_UPLOAD_DIR to 'uploads' in development.
Fixes #488.
2016-03-29 11:12:29 -07:00
Eklavya Sharma 9e3c3e14f5 Partially apply Python 3 libmodernize.fixes.fix_dict_six.
Refer to #256
2016-03-19 15:52:58 -07:00
Alexander Trost 84f7a1f1ea Make rabbitmq, redis, and memcached configurable via user settings.py.
Previously these were hardcoded in zproject/settings.py to be accessed
on localhost.

[Modified by Tim Abbott to adjust comments and fix configure-rabbitmq]
2016-01-21 22:07:56 -08:00
Javier Ros a6a47aacde Add easy support for using a remote postgres database. 2016-01-11 08:56:03 -08:00
Tim Abbott 99975400df Move LDAP password configuration to zulip-secrets.conf. 2015-12-25 16:47:48 -08:00
Tim Abbott af8d75332c Move email_gateway_password to zulip-secrets.conf. 2015-12-25 16:47:48 -08:00
Tim Abbott f4e87936da Silence 'Starting new HTTP connection' logs from requests library. 2015-12-25 16:23:57 -08:00
Tim Abbott 9d108989f3 Silence SimpleQueueClient info output by default. 2015-12-25 16:23:57 -08:00
Chris Chapman 44a9e1dff5 Fix for setting file upload size through settings file.
(Slightly tweaked by Tim Abbott to change the variable name, docs, and
default values).

Fixes #276.
2015-11-24 06:06:46 -08:00
Allie Jones 85809e6140 Add webpack build process. 2015-11-06 09:13:25 -08:00
Shumbashi 123791bfdd Fix 'manage.py makemessages' errors.
Running 'manage.py makemessages' produced two errors previously.

Closes #265.
2015-11-04 07:39:48 -08:00
Tim Abbott 2ea0663a4a Apply Python 3 futurize transform libmodernize.fixes.fix_imports_six. 2015-11-01 09:26:16 -08:00
Tim Abbott 9c66229456 Apply Python 3 futurize transform libfuturize.fixes.fix_absolute_import. 2015-11-01 09:26:16 -08:00
Tim Abbott 140e598a89 Update configuration examples to use current Google auth backend. 2015-09-26 13:50:28 -07:00
Tim Abbott ae4cb6df35 Make python-postmonkey not a required package.
This is in some ways a regression, but because we don't have
python-postmonkey packaged right now, this is required to make the
Zulip production installation process work on Trusty.

(imported from commit 539d253eb7fedc20bf02cc1f0674e9345beebf48)
2015-09-25 00:22:14 -07:00
Tim Abbott a0006d5faf Remove duplicate REQUIRED_SETTINGS check.
This makes fetching settings from here for the rabbitmq config not
work; and the main place we check for this is in initialize-database
anyway.

(imported from commit fcc6eff3882f880fdc8b127daffc9a3173f3ff20)
2015-09-25 00:22:14 -07:00
Tim Abbott 36a9dc2cf7 Cleanup various minor Zanitization issues.
(imported from commit 5784eb5ac70706f72b05463354434a83a6e1beaa)
2015-09-20 00:25:38 -07:00
Reid Barton 73264ab530 Move VOYAGER detection to after initialization of ZULIP_COM
(imported from commit c9aa814ebc30a78abe8babfc3bf2eedb8198d17d)
2015-08-29 12:07:33 -07:00
Tim Abbott 17fd248f23 Move postgres host configuration for zulip.com out of settings.py.
(imported from commit fe95011ae86ff7c5f20c789b459a763326da374d)
2015-08-22 13:49:43 -07:00
Tim Abbott 930c64df8a Move zulip.com-related statsd configuration out of main settings.py.
This also removes the convenient way to run statsd in the Dev VM,
because we don't anticipate anyone doing that.  It's just 2 lines of
config to configure it anyway:

STATSD_HOST = 'localhost'
STATSD_PREFIX = 'user'

(imported from commit 5b09422ee0e956bc7f336dd1e575634380b8bfa2)
2015-08-22 13:49:43 -07:00
Tim Abbott 3e87c82d56 Reorganize settings.py to put the default values in a sane place.
(imported from commit 00f09c6c65cb95d29c466e996b17f80a30635acf)
2015-08-22 13:49:43 -07:00
Yoyo Zhou 50ccbc4230 Refactor database configuration to make ZULIP_COM the special case instead of the default.
(imported from commit bba7a3a78dc4fd0e442503f8707295eabc581652)
2015-08-22 13:48:52 -07:00
Yoyo Zhou 8549606eb3 Require ALLOWED_HOSTS to be set in production.
(imported from commit 581e3d44aa42b5c8e6322b760b8b66a1f0aaf375)
2015-08-22 13:48:52 -07:00
Tim Abbott da84aa3412 Require REQUIRED_SETTINGS in PRODUCTION.
(imported from commit 7f43ba4d54021f806481b2e369c5482b0e0f99fe)
2015-08-22 13:48:47 -07:00
Tim Abbott 6f50a2703e Remove duplicate ZULIP_COM detection from settings.py.
And fix up some required configuration.

(imported from commit 761758638baa297118848c9f5640638d6b2f4f67)
2015-08-21 10:48:13 -07:00