Commit Graph

1605 Commits

Author SHA1 Message Date
Feorlen 78b9b83650 Create new webhook walkthrough page from the integration guide.
Breaks out the Hello World example to create a new
webhook-walkthrough.md. Includes minor edits so the two docs
read well. Adds the new page, "Webhook walkthrough", to the TOC.

Fixes #3498
2017-02-07 18:22:31 -08:00
Tim Abbott d98c19ca98 lint: Include pep8 checks in pre-commit hook. 2017-02-07 13:22:01 -08:00
Tim Abbott 1005d70ff5 update-prod-static: Fix incorrect ordering of venv setup code.
We should check if we succeeded in using a venv only after we've
actually setup sys.path to use it.
2017-02-07 11:49:31 -08:00
sinwar eab355b0cd tools: Create more consistent checks for venv.
This helps make the Zulip development environment somewhat more robust
to new contributors, since it will give them a nice warning if they
try running any of our development tools outside the Zulip virtualenv.

Fixes #3468.
2017-02-06 21:50:32 -08:00
Tim Abbott d71f2e7b9b update-prod-static: Don't ship node_modules.
This saves more than 50MB of unnecessary duplicate content in release
tarballs (the static assets that will actually be served have already
been built at this point by tools/minify-js).
2017-02-06 17:21:34 -08:00
Tim Abbott e2ee1951e0 storage: Fix static files storage reuse issues.
Zulip's previous model for managing static asset files via Django
pipeline had some broken behavior around upgrades.  In particular, it
was for some reason storing the information as to which static files
should be used in a memcached cache that was shared between different
deployments of Zulip.  This means that during the upgrade process,
some clients might be served a version of the static assets that does
not correspond to the server they were connected to.

We've replaced that model with using ManifestStaticFilesStorage, which
instead allows each Zulip deployment directory to have its own
complete copy of the mapping of files to static assets, as it should
be.

We have to do a little bit of hackery with the staticfiles.json path
to make this work, basically because Django expects staticfiles.json
to be under STATIC_ROOT (aka the path nginx is serving to users), but
doing that doesn't really make sense for Zulip, since that directory
is shared between different deployments.
2017-02-06 16:10:24 -08:00
Tim Abbott c1f0ed5637 update-authors-json: Improve error handling. 2017-02-05 12:34:05 -08:00
hackerkid 90f8eb7c52 Add tool for scanning issues without area labels.
Fixes #3495
2017-02-03 09:59:35 -08:00
Tim Abbott fa02dfdff4 mobile: Add an endpoint for checking compatibility. 2017-02-03 09:55:34 -08:00
K.Kanakhin cb1d61cae0 run-dev: Add pid file to development server.
- Add pid file of development processes group, which allows to
  manage development processes group with os utils. Also it allows to
  kill subprocesses  when parent process was closed incorrectly.
- Add tool 'stop_dev_server' to stop development server by pid file.

Fixes #1547
2017-02-02 21:07:03 -08:00
Steve Howell bcfe1bcdbe linters: Handle comments better in template parser.
We now properly parse HTML comments that have HTML
block tags or handlebars/Django blocks within them.
2017-02-02 20:55:43 -08:00
Steve Howell 2a07b204bf css parser: Show line numbers for errors.
This is a fairly major overhaul of the CSS parser to support
line numbers in error messages.

Basically, instead of passing "slices" of tokens around, we pass
indexes into the token arrays to all of our sub-parsers, which
allows them to have access to previous tokens in certain cases.
This is particularly important for errors where stuff is missing
(vs. being wrong).

In testing this out I found a few more places to catch errors.
2017-02-01 10:02:03 -08:00
Harshit Bansal 59d22e7cb8 realm_emoji: Cleanup an unreachable try/except block.
Fixes: #3515.
2017-01-30 16:43:02 -08:00
Tim Abbott 884aa2b184 streams: Eliminate last use of get_stream in views. 2017-01-29 22:07:14 -08:00
Tim Abbott b1c2ff9d05 lint: Ban most use of get_stream from zerver/lib/actions.py. 2017-01-29 20:27:00 -08:00
Tim Abbott 7be34357b2 rename_stream: Move stream name taken check to view. 2017-01-29 20:27:00 -08:00
Tim Abbott 3f83ea3879 lint: Ban use of get_stream in most views files. 2017-01-29 20:26:59 -08:00
Tim Abbott de68dd2860 lint: Ban use of Stream.objects.* in zerver/views. 2017-01-29 20:26:59 -08:00
Tim Abbott bb86bba20d stream_exists_backend: Use access_stream_by_name. 2017-01-29 20:26:59 -08:00
Tim Abbott 0af34ee710 streams: Add zerver/lib/streams.py library for security checks.
The goal of this library is to make it a lot easier to prevent bugs
like CVE-2017-0881 by having all of our views logic for fetching a
stream go through a couple carefully tested code paths.
2017-01-29 20:26:58 -08:00
Tim Abbott 234eb7a723 emoji: Add a bunch of documentation in comments for emoji rules. 2017-01-29 12:33:44 -08:00
Rishi Gupta e19f3d5534 emoji: Make minor adjustments to emoji names list. 2017-01-29 12:19:54 -08:00
Rishi Gupta 6f307ffd08 emoji: Switch the order of thumbs_up and thumbs_down in autocomplete. 2017-01-28 23:38:03 -08:00
Rishi Gupta 8ef5197d5c emoji: Remove problematic color emoji from autocomplete and picker. 2017-01-28 23:38:03 -08:00
Rishi Gupta a2890f7d7a emoji: Remove duplicates from autocomplete and emoji picker.
Previously, if you searched for ':offi..' you would see both 🏢 and
:office_building: as possible completions, both of which are shortcodes for
the same unicode codepoint (and hence which have the same image). Also, we
sort the emoji in our emoji pickers alphabetically by shortcode, and so the
images for 🏢 and :office_building: show up next to each other, which
looks like a bug. This removes :office_building: as a shortcode, along with
several hundred other duplicates. It leaves some duplicates in that won't
give autocomplete or alphabetical ordering a problem, like (🚗,
:automobile:).
2017-01-28 23:38:03 -08:00
Yago González 87a7691bfc translations: Improve some strings. 2017-01-28 18:58:09 -08:00
Tim Abbott bd6f71580e docs: Remove obsolete terms-enterprise page.
This was documentation for the old zulip.com enterprise service that
no longer exists.
2017-01-28 18:12:19 -08:00
Rishi Gupta 6b3abce541 build_emoji: Generate emoji names and codepoints from emoji_map.
Replaces the hardcoded list of emoji_names and unicode_emoji_names in
static/js/emoji.js with a list generated from emoji_map.json, both to get
the list out of version control and so we can start modifying it for our
autocomplete. This does not change the contents of emoji_names. It sorts and
removes duplicates from unicode_emoji_names (causes no change in behavior,
since unicode_emoji_names is only used as if it were a set).
2017-01-28 17:05:32 -08:00
Tim Abbott f6f8168f4d emoji: Build emoji before minifying JS.
Since build_emoji will soon be generated
static/generated/emoji_data.js (containing the emoji data), we need to
generate those JavaScript files before minifying them.
2017-01-28 12:15:34 -08:00
Brock Whittaker 1dd8fb7966 Display realm emojis in the emoji picker container.
This displays the realm emojis in the emoji picker container in their
own divs styled similarly to the existing .emoji divs.
2017-01-27 15:39:22 -08:00
Tomasz Kolek 6e6cbeb89d Split webhooks doc and move to particular directories. 2017-01-26 11:56:45 -08:00
Tomasz Kolek 7de45951e2 Make webhooks as separate modules with view and tests.
Create python packege for every webhook with view.py and tests.py
2017-01-25 23:14:19 -08:00
Tim Abbott 06cd40d461 travis: Run test-api in Travis CI. 2017-01-25 16:42:17 -08:00
Tim Abbott 015ab412bc test-api: Log API tests status. 2017-01-25 16:42:09 -08:00
Steve Howell 9177f17d73 Simplify tools/test-help-documentation.py.
It now uses the test_server_running() context manager to
get a test server running.
2017-01-25 16:33:19 -08:00
Steve Howell 5799183e10 Add use_db flag to test_server_running(). 2017-01-25 16:33:19 -08:00
Steve Howell 38f5f3a76e tests: Move logging into test_server.py for Casper. 2017-01-25 16:33:19 -08:00
Steve Howell 6de1e8be46 Add test-api to tools/test-all. 2017-01-25 16:33:19 -08:00
Tim Abbott 126b1c4edc upgrade: Don't require authors updates deploying from Git.
Fixes #3392.
2017-01-23 23:00:09 -08:00
Tim Abbott 4e171ce787 lint: Clean up E126 PEP-8 rule. 2017-01-23 22:06:13 -08:00
Tim Abbott 31e7dcd86b lint: Tag remaining PEP-8 rules with explanations. 2017-01-23 21:43:33 -08:00
Tim Abbott 376aa3e404 lint: Clean up E702 PEP-8 rule. 2017-01-23 21:37:27 -08:00
Tim Abbott de99f48ce7 lint: Clean up E401 PEP-8 rule. 2017-01-23 21:36:39 -08:00
Tim Abbott d6e38e2a5c lint: Clean up E123 PEP-8 rule. 2017-01-23 21:34:26 -08:00
Tim Abbott 9cc83f87fc lint: Clean up E241 PEP-8 rule. 2017-01-23 21:21:14 -08:00
Tim Abbott fe4f7b1170 lint: Clean up E711 PEP-8 rule. 2017-01-23 21:11:49 -08:00
Tim Abbott 9640a9e864 lint: Clean up E712 PEP-8 rule. 2017-01-23 21:11:18 -08:00
Tim Abbott e385b93448 lint: Clean up E713 PEP-8 rule. 2017-01-23 21:08:52 -08:00
Tim Abbott a088cdaa04 lint: Clean up E714 PEP-8 rule. 2017-01-23 21:07:45 -08:00
Tim Abbott d96f392147 lint: Clean up E741 PEP-8 rule. 2017-01-23 21:07:04 -08:00
Tim Abbott e5daec46ec lint: Clean up E306 PEP-8 rule. 2017-01-23 21:05:08 -08:00
Tim Abbott e3e92903eb lint: Document why E305 is turned off. 2017-01-23 21:03:46 -08:00
Tim Abbott e9158dd520 lint: Clean up E121 PEP-8 rule. 2017-01-23 21:02:39 -08:00
Tim Abbott 6f0d2a9445 lint: Clean up E115 PEP-8 rule. 2017-01-23 20:55:37 -08:00
Feorlen 378ac3abf3 Lint yaml files using text file rules.
Fixes #3404
2017-01-23 20:53:20 -08:00
Tim Abbott df3d6aee5d lint: Clean up E114 PEP-8 lint rule. 2017-01-23 20:52:58 -08:00
Tim Abbott 22d1aa396b lint: Clean up W503 PEP-8 warning. 2017-01-23 20:50:04 -08:00
Tim Abbott bde2da7dfd lint: clean up PEP-8 W391 rule. 2017-01-23 20:39:02 -08:00
Zev Benjamin f4d3cc6545 Annotate ignored pep8 rules to explain why they're ignored 2017-01-23 20:19:58 -08:00
Robert Hönig bef93959d3 Restructure converter bot.
Apply the new layout for 'contrib_bots' bots to the converter bot
to make it an exemplary model for new bots.
2017-01-22 05:42:46 -08:00
Robert Hönig 4415d6085f Restructure contrib_bots bots to new layout.
In order to make the layout of all bots consistent, this commit
moves each bot into a folder with its name and modifies 'run.py'
so that only bots with such a structure can be executed. 'lib'
gets renamed to 'bots'.
2017-01-22 05:42:46 -08:00
Rohith Asrk 9088c46e4c templates: Fix filename ending with .html.txt.
Fixes a part of #3136.
2017-01-21 22:44:13 -08:00
Tim Abbott aadf621466 test-backend: Only check for unrendered templates if tests passed. 2017-01-20 10:56:03 -08:00
Tim Abbott 1a536f381c lint: Fix some PEP-8 lint errors. 2017-01-19 16:42:50 -08:00
Tim Abbott d091691b3d lint: Require access_message to access Message objects. 2017-01-19 15:59:06 -08:00
Steve Howell 0ff2c5881e provision: Simplify messaging in tools/provision.
The script now outputs bullet points to the user when
it fails, and there are some basic comments at the top
of the file.  I also fixed the path of the log file.

Fixes #3230
2017-01-19 14:55:22 -08:00
Tim Abbott 286f640194 minify: Clean up unnecessary tuple/list complexity. 2017-01-19 14:51:16 -08:00
Tommy Ip 23a7685fa5 deps: Add option to skip minifying Javascript files.
Plotly.js take around 20 seconds to minify with the Closure
compiler so it is taken out.

Fixes #3076.
2017-01-19 14:31:38 -08:00
Sampriti Panda 6484af6854 tools: Fix regressions in tools/tests/test_html_branches.py 2017-01-19 08:02:34 -08:00
Tim Abbott 699d30b1eb provision: Ensure that stderr output isn't buffered badly.
Previously, if a script called by provision threw an error, the
traceback for the called script would be lost far above the traceback
from provision itself in the terminal history, resulting in a great
deal of confusion about what the actual problem was.
2017-01-17 14:28:10 -08:00
Robert Hönig 789ae8648a Add wrapper and log file output for provisioning.
Before this commit, provisioning was done by executing provision.py,
which printed the log directly to stdout, making debugging harder.
This commit creates a wrapper bash script 'provision' in tools, which
calls 'zulip/scripts/tools/provision_vm.py' (the new location of
provision.py) and prints all the output to
'zulip/var/log/zulip/zulip_provision.log' via 'tee'.
Travis tests and docs have been modified accordingly.
2017-01-17 14:23:28 -08:00
Tim Abbott 4f67b9802d travis: Use fixture for authors page in CI. 2017-01-17 13:42:37 -08:00
Tommy Ip c407919db3 Add /authors page.
Contributor visualization showing the avatar, user name and number
of commits for each contributors. The JSON data would be updated
upon deployment, triggered by the `update-prod-static` script.
2017-01-17 13:35:55 -08:00
Tim Abbott 747f66bfe1 docs: Add README.md files for scripts/ and tools/. 2017-01-17 11:01:27 -08:00
Steve Howell 7afb19e0d4 Add test driver for the API. 2017-01-16 21:12:39 -08:00
Steve Howell c6b2d531ef Extract tools/lib/test_server.py
This new module abstracts the setting up of a test
server for tests to run, pulling existing code from
casper and paving the way for API tests in the future.
2017-01-16 21:12:39 -08:00
hackerkid c55a0dd237 provision: Check for shell_profile files before creating them. 2017-01-16 19:58:01 -08:00
adnrs96 153ad18807 Lint for duplicate ids in templates.
In this commit we enhance our current template linter to detect
duplicate ids and report them during lint checks. html_branches.py
was topped up with a new function build_id_dict for the purpose.

Also the get_tag_info function in same file was updated to parse
ids and classes more robustly in cases of template variables.
split_for_id_and_class function was added to serve this purpose.

Unit tests for both the functions were created under
tests/test_html_branches. Also a directory under tests called
test_template_data was created to hold templates for testing under
newly created functionality.

check_templates was modified to print to console any duplicates
detected.
showell reviewed my commit and helped me out.

Fixes #2950.
2017-01-13 17:00:22 -08:00
hackerkid 510659d402 Add virtualenv activation in .zprofile. 2017-01-13 15:13:44 -08:00
Tim Abbott a64a1de023 lint: Be more permissive with Markdown links. 2017-01-12 16:42:51 -08:00
Steve Howell baef662dcb Add tools/review for reviewing PRs.
This script ensures you are starting on master in a pristine
state, and then it creates a branch called review-NNNN for
PR #NNNN in your local repo, along with some basic stats about
the PR.
2017-01-12 15:26:40 -08:00
Steve Howell 7bd16b3946 dev tools: Diagnose venv problems more clearly.
In tools/diagnose, we now catch an ImportError if
we cannot import django, and we instruct the
devloper about the mostly likely remedies.
2017-01-12 13:46:05 -08:00
Steve Howell 5ec0bc1213 Fix typing import in tools/diagnose. 2017-01-12 10:49:11 -08:00
K.Kanakhin aaf82ae090 documentation-crawler: Check images in help documentation.
This checks both that all images under static/images/help/ are used in
the help documentation, and also that none of the image tags are broken.

- Improve documentation spiders and crawler with spider error state.

Fixes #3070.
2017-01-12 10:02:32 -08:00
JefftheBest1 110398bf36 Fixed typos in test-queue-worker-reload 2017-01-12 04:51:27 -08:00
Tim Abbott 3f8d4193da lint: Fix % comprehensions being used without a tuple. 2017-01-09 11:45:11 -08:00
sinwar 3f350391ce docs: Ban the term realm from user documentation.
Fixes #3031.
2017-01-09 10:58:19 -08:00
Tim Abbott 3a64857a4c lint: Fix long lines not being treated as actual errors.
This led to Travis CI not reporting on line-too-long errors.
2017-01-08 22:48:27 -08:00
Tim Abbott b54f8b3b14 lint: Fix incorrect line length calculations in Python 2.
Previously, we would incorrectly be counting bytes in Python 2, which
meant lines with unicode characters in them appeared to the linter to
be far longer than they actually were.
2017-01-08 22:46:02 -08:00
Tommy Ip 89dc739856 tools: Fix bare except clause. 2017-01-08 16:22:21 -08:00
Tommy Ip e04afe9bda tools: Fix bare except clause. 2017-01-08 16:22:21 -08:00
Tim Abbott 24df5fbd97 Delete remains of deprecated inject-messages. 2017-01-07 10:53:20 -08:00
AZtheAsian 0dc9ac7dac Delete deprecated iframe-bot. 2017-01-07 10:53:20 -08:00
Tim Abbott e228243723 install-aws-server: Add support for installing zulip.conf. 2017-01-06 21:58:16 -08:00
Tim Abbott c6bdc2130b install-aws-server: secrets enhancements. 2017-01-06 21:57:20 -08:00
Tim Abbott ed0da5f874 install-aws-server: Fix usage output. 2017-01-06 21:57:20 -08:00
Tim Abbott 246bdbd829 update-prod-static: Fix node_modules/.bin being unavailable in prod.
Apparently `manage.py collectstatic` by default strips files starting
with "." from what it collects.  This is a reasonably precaution,
though mostly irrelevant to us, since Zulip primarily runs that as
part of build-release tarball, which runs in a clean directory.

It also breaks our current approach for transferring node_modules to
prod machines via release tarballs; this change fixes that bug.
2017-01-06 20:23:46 -08:00
Tim Abbott 7df44f2e87 minify-js: Auto-detect virtualenv when possible.
Usually, update-prod-static takes care of this, but it's useful for
debugging purposes to be able to rerun this manually.
2017-01-06 19:55:08 -08:00
Tim Abbott 3a3a1872e7 travis: Prevent upgrading oracle-java9-installer.
This fixes a minor performance problem, and also avoids errors when
Oracle's Java installer site is down.
2017-01-06 19:30:16 -08:00
Tim Abbott 0f50ef12f5 scripts: Fix path to install-node. 2017-01-06 16:48:18 -08:00