Commit Graph

2742 Commits

Author SHA1 Message Date
Shubham Padia 55619cbe70 browser-support: Add string.prototype.endswith polyfill.
String.prototype.endsWith is not supported in ie11.
Adds string.prototype.endswith package to dependencies and places
it at `common` entry point in webpack.assets.json.
2018-04-11 15:40:57 -07:00
Shubham Padia 57a494f94d browser-support: Add codepointat polyfill to `common` entry point.
Adds string.prototype.codepointat which was added as a polyfill
earlier to the project but was not added to `common` entry point.
2018-04-09 12:16:19 -07:00
Shubham Padia b906562f22 browser-support: Add string.prototype.startsWith polyfill.
Fixes #8944.
Adds string.prototype.startswith package to dependencies and places
it at `common` entry point in webpack.assets.json. As common.js is
loaded on all code paths first, there is no need to place this package
into other entry points.
2018-04-09 12:16:19 -07:00
Aditya Bansal b9f1acb300 linter: Enforce 2 space indents on tags spread over multiple lines.
We make some specific cases of tags use 2 space indents.
The case description:
* A tag with opening tag spread over multiple lines and closing tag
on the same line as of the closing angle bracket of the opening tag.
* A tag with opening tag spread over multiple lines and closing tag
not on the same line as of the closing angle bracket of the opening
tag.

Example:
Case 1:

Not linted:
<button type="button"
class="btn btn-primary btn-small">{{t "Yes" }}</button>

After linting:
<button type="button"
  class="btn btn-primary btn-small">{{t "Yes" }}</button>

Case 2:

Before linting:
<div class = "foo"
     id = "bar"
     role = "whatever">
     {{ bla }}
</div>

After linting:
<div class = "foo"
  id = "bar"
  role = "whatever">
    {{ bla }}
</div>
2018-04-07 20:08:44 -07:00
Aditya Bansal 550222dede linter: Make multiline handlebar singleton tags use 2 space indentation. 2018-04-07 20:08:38 -07:00
Aditya Bansal 2fe012ffff linter: Make html singleton tags use 2 space indentation. 2018-04-07 20:08:31 -07:00
Alyssa Wagenmaker df666c3dfc test-backend: Report fully covered files still in not_yet_fully_covered. 2018-04-06 17:29:18 -04:00
Ben Reeves 29a079ebbf test-backend: Remove fully covered files from not_yet_fully_covered. 2018-04-06 17:29:18 -04:00
Tim Abbott b0b134cb4c help: Clean up settings_html and subscriptions_html.
After some thinking, I don't think there's any actual value to doing
the ../ style relative links here, whereas there is actual harm from
the links being slightly broken in the current model.  We fix this by
just using /#settings as the URL.

Fixes #8978.
2018-04-05 14:48:26 -07:00
Tim Abbott ed5b374ffa help docs: Fix a sorta buggy URL test. 2018-04-05 13:07:34 -07:00
Steve Howell e145258fee node tests: Add 100% coverage for components.js. 2018-03-29 08:09:38 -07:00
neiljp (Neil Pilgrim) 090b47ed19 mypy: Add explicit Optional for default=None parameters in various files. 2018-03-28 12:31:51 -07:00
neiljp (Neil Pilgrim) 07971d3a66 linter: Add check that Optional models are tagged with null=True.
Exclude NullBooleanField explicitly.

Amend one line in models.py found from this linter change.
2018-03-27 10:21:25 -07:00
neiljp (Neil Pilgrim) 7d93f5726c linter: Add check that null=True lines are annotated as Optional.
Also add two missing annotations of this type that were missed
until linted.
2018-03-27 10:21:25 -07:00
Joshua Pan 0f58f20ad8 tests: Clean up test-js-with-node output on success. 2018-03-26 06:35:58 -04:00
Joshua Pan ed9eb3bdb5 tests: Make test-js-with-node handling smarter.
Added support for passing a filename without `.js` suffix.
This then fixed the issue of no complaints for invalid test
files. Now, throws an error for invalid test files.

Fixes #8579.
2018-03-26 06:35:58 -04:00
neiljp (Neil Pilgrim) 9a49812cde mypy: Extract default run-mypy options into mypy.ini. 2018-03-23 16:53:43 -07:00
neiljp (Neil Pilgrim) fb4f5c8570 tools: remove strict-optional command from run-mypy.
This is now controlled globally and on a per-file basis in mypy.ini.
2018-03-23 16:53:43 -07:00
neiljp (Neil Pilgrim) 70117f0e83 mypy: Add asserts of intermediate values in update-authors-json. 2018-03-23 13:07:39 -07:00
neiljp (Neil Pilgrim) f0e3fcb937 mypy: Amend test-backend:internet_guard to return NoReturn.
It is guaranteed to raise an exception, so this is reasonable,
and it satisfies mypy.
2018-03-23 11:39:54 -07:00
sinwar 675e844e6b team page: Add contributors of zulip-terminal.
It adds zulip terminal contributions to
team page using github apis.
2018-03-22 21:06:18 -07:00
Tim Abbott 08a6271b54 update-authors-json: Improve error handling for duplicate commits.
It's possible that a user with duplicate commits might not be in the
top 100 users for a given repo.
2018-03-22 14:58:13 -07:00
Gooca 2363c9955a ui scrollbar: Update perfect-scrollbar to 1.3.0.
Update perfect-scrollbar to fix stutter space-scrolling in #8544. Also
reworked deprecated `element.perfectScrollbar` to `new
PerfectScrollbar(element)`.  Lastly, updated provision version and
changed node module path to new path.

This also refactors perfect-scrollbar in help.js to work with updated
version of perfect-scrollbar. Because the update also changed
perfect-scrollbar's css selectors for all scrollbars in zulip, we
update those too.

Fixes #8544.
2018-03-20 21:59:11 -07:00
Tim Abbott 791953963b check-capitalization: Include banned words in overall output.
This locks down the ban on use of "Realm" in translated strings in the
codebase.
2018-03-16 16:59:02 -07:00
Tim Abbott 8e334b0f64 check-capitalization: Exclude certain uses of the word "realm".
Uses that are actually a variable name don't make sense to exclude.
2018-03-16 16:58:49 -07:00
neiljp (Neil Pilgrim) 966ca7015f mypy: Finalize migration of cache.py to python3 function annotation.
- Use forward declarations of some types from models.py to avoid cycles.
- Remove cache.py from linter rule exclude list to ensure it stays that way.
2018-03-16 11:29:12 -07:00
Vishnu Ks c385fcefa8 templates: Fix translation tag for disposable email tooltip. 2018-03-15 14:35:24 -07:00
neiljp (Neil Pilgrim) a3d8cc1f86 Mypy: Migrate tornado/descriptors.py to python3 function annotations.
Use quoted form of ClientDescriptor to break presumed circular dependency,
and modify import statement to shorten quotes.
2018-03-15 12:54:43 -07:00
neiljp (Neil Pilgrim) a7bfb09067 Mypy: Use models.py QuerySet annotation approach in stream_subscription.py.
Namely, annotate as best as possible, and add notes to indicate preference,
if QuerySet develops generic typing.

Note that the return values of functions with annotations changed in this
commit are used elsewhere as QuerySets, so the Sequence[T] approach used
for some functions in models.py is not applicable.
2018-03-15 12:54:43 -07:00
neiljp (Neil Pilgrim) ce4ac0d2cf Mypy: Ensure consistency of QuerySet return types in models.py.
Other functions took the form of returning Sequence[T] when the QuerySet
functionality is unused beyond the function, with T being the objects
filtered for in the function body; this commit follows that practice for the
one remaining python2 comment-annotated function, completing the transition
of models.py to py3.5 function annotations.

A note is also added to another function regarding a need to return a
QuerySet, and ideally a QuerySet[T] in line with the other functions, as and
when QuerySet becomes annotated as a generic.
2018-03-15 12:54:43 -07:00
Tarun Kumar c8d5cf7d6c user-groups: Achieve 100% node-test coverage of user_groups.js.
Fixes #8704.
2018-03-15 10:09:28 -07:00
Harshit Bansal 40958e0824 emoji: Switch to 64px 256 color indexed sprite sheets.
This commit switches our emoji infrastructure to use 256 color indexed
64px spritesheets. Earlier we were using non-indexed 32px spritesheets
which were blurry on high dpi displays. These indexed spritesheets not
only provide a crispier display but are also smaller in size.

This commit also removes the `emoji-datasource` package as a dependency
as all the data is now sourced from individual datasource packages.

Fixes: #7862.
2018-03-14 10:28:45 -07:00
neiljp (Neil Pilgrim) 43ff4ea1f7 tools: Ensure mypy is run on .pyi files. 2018-03-13 13:49:39 -07:00
Tim Abbott 8866c23b5e test-backend: Enforce 100% test coverage on models.py.
Following the exclusions and code deletions we just did, we can now
lock down 100% test coverage on zerver/models.py.
2018-03-12 11:52:39 -07:00
neiljp (Neil Pilgrim) ee2b8bfbfb linter: Require Py3 function annotations, with some exceptions.
Main exceptions are scripts/tools/puppet & tests.

Other current exclusions:
- api_test_helpers.py (avoid changing test code);
- cache.py, due to comments in file;
- models.py, due to failure on QuerySet[Message];
- stream_subscription.py, due to failure on QuerySet[Subscription];
- tornado/descriptors.py;
- views/streams.py, due to remaining FuncKwargPair issue;
- zthumbor/, since thumbor is in python2.

Tweaked by tabbott to partially document the stauts in comments.
2018-03-12 11:23:30 -07:00
Umair Khan 728cd04c4d check-capitalization: Check for banned words.
Fixes #8619
2018-03-11 15:34:47 -07:00
Steve Howell fef2840531 Add FetchStatus class.
We will use this in subsequent commits to replace the
`load_more_enabled` flag.
2018-03-09 14:20:58 -08:00
sinwar 6bed6ccdcf team page: Remove duplicate contribution counts.
It removes duplicate contribution count from zulip-server.

Fixes #7836.
2018-03-07 17:25:41 -08:00
Steve Howell 3e76d523c7 node tests: Add tests for user_pill.js.
This gets coverage to 100%.  (We already had a lot of indirect
coverage, but these tests should have more obvious failure
symptoms.)
2018-03-07 15:53:11 -08:00
Greg Price f22712e8e8 install: Go straight through by default.
This flips the experimental `--express` option to be the default.

We retain the old behavior, where the script exits before
`initialize-database`, as an option `--no-init-db`; it might be useful
in e.g. a migration scenario (from a Zulip install elsewhere, or
another chat system) where the admin wants to set up the database
separately.

The install instructions are adjusted to match, getting shorter by two
steps and a bunch of words.  I think this opens up opportunities to
refactor the text to simplify things further, too, but leaving that
for another commit.

Also tweak the "production" test suite to match.
2018-03-06 19:43:02 -08:00
Greg Price 8111848ac4 test-install: Do a dist-upgrade in prepare-base.
This keeps the base tree up to date, saving the time we'd spend
doing the same upgrades in each test install.
2018-03-06 19:43:02 -08:00
Tim Abbott f253f96211 lint: Add "Gravatar" to capitalized terms in linter. 2018-03-05 10:29:18 -08:00
Tim Abbott 4d8e18e58f settings: Move display_checkmark to settings_ui.js. 2018-03-04 18:26:27 -08:00
Tim Abbott 6a06e453c7 display_settings: Extend de-duplication of unnecessary logic.
We add a new option to the change_display_setting function to support
cases with a custom on-success or on-failure message.
2018-03-04 18:09:46 -08:00
Balaji2198 5aa7098c81 display_settings: Change success/failure feedback interface.
This replaces the cumbersome system we had for giving users feedback
on settings state changes in the display settings UI.

We expect this new system to be what we will attempt to migrate other
settings widgets to match over the coming weeks and months.  It also
provides the opportunity to significant refactor away a lot of the
code duplication in settings_display.js.

Thanks to Brock Whittaker for redoing the styling and improving the
code simplicity.

Fixes #7622.
2018-03-04 17:47:05 -08:00
Tim Abbott a3ca7ee1c7 lint: Add a few strings to capitalization linter.
My hope is that we'll be able to eliminate these strings from the UI
altogether soon, but this is needed to keep CI passing for now.
2018-03-04 16:34:00 -08:00
Robert Hönig 81ba7a1e40 Mark DigestWorker and PushNotificationsWorker as nocoverage.
These two classes are tricky to test, and nocoverage-ing them
allows us to mark queue_processors.py as fully covered. We
still want to cover these two workers at some point, but for
now, it's nice to enforce full coverage for any future changes
to queue_processors.py.

Fixes (sort of) #6542.
2018-03-04 13:31:33 -08:00
Tim Abbott 530e098916 node: Remove 100% coverage requirement for user groups.
This is a temporary change to get CI passing again; we lost some
coverage in aed8cc9062, which fixed some
major bugs in the feature.
2018-03-04 10:11:11 -08:00
YJDave f5a24efdd8 static/js: Add `settings_ui.js` file for common settings UI functions. 2018-03-03 08:38:54 -08:00
Eeshan Garg 59581f6a32 tools/lint: Require a space after every `:` in JSON files. 2018-03-02 14:10:53 -08:00
Tim Abbott 335c383bbb lint: Add some excludes to capitalization linter. 2018-03-02 11:55:46 -08:00
Tim Abbott 895b5642f1 commit-message-list: Don't print anything if no commits.
This fixes some output spam when running the linter at
upstream/master.
2018-03-02 11:51:08 -08:00
Tim Abbott 14764d015a settings: Tag cookie bot placeholder short name for translation. 2018-03-02 09:33:16 -08:00
Tim Abbott e18537d842 emoji: Add a translation tag for new_emoji placeholder. 2018-03-02 09:32:09 -08:00
Tim Abbott 9c4b0cc100 lint: Clean up translation tag lint for filter settings. 2018-03-02 09:30:42 -08:00
Tim Abbott f9210bace8 lint: Add a translation tag for marketing. 2018-03-02 09:28:57 -08:00
Joshua Pan 5777582013 lint: Tighten placeholder lint rule to exclude links.
Fixes #8420.
2018-03-02 09:24:09 -08:00
Tim Abbott 5ccd3aa71b i18n: Run process-mobile-i18n when syncing translations. 2018-03-02 08:59:00 -08:00
Tim Abbott 3be0b3dd91 mypy: Fix errors in linter.
We should figure out a better way to manage this issue.
2018-03-01 20:33:30 -08:00
Tim Abbott 8d00266fd6 lint: Add a linter rule banning use of sudo in most scripts.
This should help prevent against bugs where we accidentally introduce
use of sudo somewhere in the production installer or upgrade code path
(these used to happen all the time), which doesn't work on production
systems that don't have sudo setup.
2018-03-01 16:30:31 -08:00
Greg Price 72497d61c1 test-migrations: Clean up a bit. 2018-03-01 15:03:55 -08:00
Aditya Bansal bd0a5d5d69 css-minifier: Lint for '+' operator in calc().
Fixes: #8403.
2018-03-01 13:26:16 -08:00
Tim Abbott 6b31752f82 user_groups: Change placeholder group to "Marketing team".
This is much more something that would apply to likely customer
organizations.
2018-03-01 11:28:24 -08:00
Vishnu Ks 36f6ad76b4 admin ui: Set usergroup name input maxlength to 100.
Same as that of the maxlength defined in backend.
2018-03-01 11:27:26 -08:00
Greg Price 4475950ddf queue: Restore prematurely-cut upgrade path.
Revert c8f034e9a "queue: Remove missedmessage_email_senders code."
As the comment in the code says, it ensures a smooth upgrade path
from 1.7.x; we can delete it in master after 1.8.0 is released.
The removal commit was merged early due to a communication failure.
2018-02-28 11:15:53 -08:00
Umair Khan c8f034e9a0 queue: Remove missedmessage_email_senders code.
After 68513952fb, all emails are sent through email_senders queue.
This commit removes code related to the legacy queue.
2018-02-21 16:43:56 -08:00
Eeshan Garg be0a04f33e api docs: Test sample fixtures for unauthorized_errors_fatal.
This commit adds tests for the sample fixtures for when
unauthorized_errors_fatal is passed to client.add_subscriptions.
2018-02-20 14:54:12 -08:00
Eeshan Garg 06bf47d2f5 api docs: Test sample fixture for user not authorized error.
This commit adds tests for the fixture for when a user is not
authorized (perhaps because the query requires the use of admin
privileges) for a particular query.
2018-02-20 14:52:09 -08:00
Eeshan Garg 124c672a7c api docs: Test sample fixture for message edit permission error.
In templates/zerver/api/update-message.md, we have a sample fixture
for when a zulip.Client does not have the permission to update/edit
a particular message. This commit adds a test for that fixture.
Also, tools/test-api now also uses a non-admin client for this test,
which might come in handy in the future.
2018-02-20 14:52:09 -08:00
Steve Howell 1f6ddf0110 refactor: Extract transmit.js from compose.js.
We now isolate the code to transmit messages into transmit.js.
It is stable code that most folks doing UI work in compose.js don't
care about the details of, so it's just clutter there.  Also, we may
soon have other widgets than the compose box that send messages.

This change mostly preserves test coverage, although in some cases
we stub at a higher level for the compose path (this is a good thing).
Extracting out transmit.js allows us to lock down 100% coverage on that
file.
2018-02-20 09:29:26 -08:00
rht 70a41cc2eb tools/tests: Use Python 3 syntax for typing. 2018-02-19 10:17:03 -08:00
ihsavru 4103996a22 org-settings: Fix styling of Allowed Domains modal.
Fixes: #7628.

Cleaned up by Brock Whittaker and Node tests fixed by Steve Howell.
2018-02-16 16:00:21 -08:00
Aditya Bansal 6fce1d7834 template_parser: Add parsing support for self closing tags as per HTML5.
In this commit we add support for some tags which are also called
void-elements according to
http://w3c.github.io/html/syntax.html#void-elements to be parsed by
our template parser and get tagged as singleton_html_tags.

Fixes: #8387.
2018-02-15 17:47:43 -05:00
Greg Price b0b0777cd0 translation: Make new tagmessages script a bit easier to run.
Now executable! Just run `tools/tagmessages`.

Also, get the username and password from a `.transifexrc` file.

And hardcode the project slug to `zulip-test` rather than to `zulip`;
the Transifex API is bad at namespacing, so this makes it possible to
run this script on a test project (the only way we're currently using
it) even for people like me who can also upload to the real Zulip
project on Transifex.
2018-02-15 13:38:09 -08:00
Robert Hönig ebf79427ca translation: Add script to tag strings in Transifex.
For now, tags are only used for backend translations with django.
2018-02-15 13:38:09 -08:00
Tim Abbott be3d43bb46 lint: Add linter rule banning $.get and friends.
These are not allowed in our style guide.
2018-02-13 16:47:59 -08:00
Shubham Padia e1f943913a lint: Allow revert commit messages in gitlint.
Fixes #8145.
2018-02-13 09:21:01 -08:00
Aditya Bansal 35969edd66 deps: Replace libz-dev with zlib1g-dev since the former was renamed. 2018-02-12 14:40:26 -08:00
Aditya Bansal d5736ef65a provision.py: Remove duplicate install candidated from APT_DEPENDENCIES.
This is necessary, since we now have some dependencies in common
between the Thumbor and main Zulip dependency lists.
2018-02-12 14:40:26 -08:00
Rhea Parekh 3ebd30120c slack importer: Remove depreciated test.
This test was added in '/tests/test_slack_importer' in
6addf79edb.
2018-02-12 00:43:02 +05:30
Greg Price b374ea7357 mypy: Pass --show-traceback.
This saves a bit of debugging in the event that we hit a crash
inside mypy.
2018-02-09 19:42:49 -08:00
Eeshan Garg 929724e5e7 api docs: Add page for common error payloads.
We now have a separate page for common error payloads, for example,
the payload for when the client's API key is invalid. All error
payloads that are presented on this page will be tested similarly
to our other non-error sample fixtures.
2018-02-08 17:58:41 -08:00
Greg Price 86590dfdbe test-install: Add command destroy-all to clean up test containers.
This is just the one-liner I've been keeping in my shell history,
cleaned up a bit (newlines!) and with 28 lines of CLI boilerplate
added in front.
2018-02-08 17:29:41 -08:00
Greg Price 6e633f8e2f install: Use readlink -f rather than realpath.
It does exactly the same thing, though the name is less transparent; and
it simplifies the script by avoiding an extra, early `apt-get install`.
2018-02-08 17:22:02 -08:00
Greg Price 4c5326ce85 test-install: Factor out booted-yet-p polling loop, use in prepare-base.
Otherwise prepare-base is likely to fail when first run (but then
succeed when rerun, because the container is left running), because
the container isn't up yet when we try to operate in it.

Also clean up the placement of `set -e` vs `set -x`.
2018-02-08 16:34:49 -08:00
Greg Price fc9970e561 test-install: Add xenial support. 2018-02-08 16:34:49 -08:00
Tim Abbott 9249454518 update-authors-json: Fix handling deleted GitHub accounts.
Apparently, we've now had the first time one of our contributors had
their account deleted (at least, the author page for the contributor
who has 21 commits in python-zulip-api now 404s).
2018-02-08 12:17:20 -08:00
Umair Khan 764cd977d6 test-queue-worker-reload: Increase delay to 1.3s.
See 625939 for more information. In short, the purpose of this delay is
to give autoreload code enough time to touch every watched file at least
once before the change is made.
2018-02-06 10:35:20 -08:00
Umair Khan c415cc74d7 validate_stream_message_address_info: Add i18n tags.
Fixes #7076
2018-02-05 16:26:24 -08:00
rht 396a8b644d provision.py: Colorize error messages for fail condition. 2018-02-05 11:44:33 -08:00
Tim Abbott 0c4aa48895 provision: Clean up error message for missing virtualenv.
This new message should be clearer; it does come up occasionally.
2018-02-05 11:44:33 -08:00
rht e8a5f68980 provision: Extract color codes into standard variables.
This uses the standard color codes we have in the Python
`zulip_tools` library.

Tweaked by tabbott to clean up some bugs.
2018-02-05 11:44:33 -08:00
Greg Price e3c82fa3ec tools/test-all: Fix small desync with CI scripts.
This script and our CI scripts tools/travis/{backend,frontend} have
stayed pretty well in sync in the 6 months since 360c27ded made that
relationship explicit and easy to check!

Just one small exception; so fix that.
2018-02-01 11:38:51 -08:00
Greg Price 34f4c822cb ci: Cut out commented-out versions of tools/lint calls.
This may or may not be temporary, but either way, the other code is
there in source control, and the "why" of disabling gitlint is the
helpful bit for a comment.
2018-02-01 11:37:00 -08:00
Robert Hönig 53b4c793f6 setup_venvs.py: Enforce Python 2.7 for zulip-thumbor-venv setup.
zulip-thumbor-venv runs only with Python 2.7. This could cause
provision failures on setups where Python 2.7 is not the default.
2018-01-31 11:29:34 -08:00
Greg Price f995ad1ed5 circleci: Simplify Dockerfile templating a bit.
Injecting the generated-file warning into the settings dict felt a
little unnecessarily magical.  A warning like this is always going
to be at the top; the way it might differ between files is mainly
if the syntax for a comment varies, and in that case a simple
substitution like we're doing in this template wouldn't be enough
to express the difference anyway.  So, embrace the hardcoding.

Now, the template and the images.yml entry have a very simple
relationship: the keys in one are exactly the keys in the other.
That's good for people quickly and confidently understanding it.
2018-01-31 10:53:13 -08:00
Greg Price 8a0b5a29b9 circleci: Use the joy of `os.makedirs(..., exist_ok=True)`.
Since Python 3.2, we no longer need to write this little wrapper
all over our own code!  There was much rejoicing.
2018-01-31 10:53:13 -08:00
Vishnu Ks 91506f1bb3 circleci: Generate xenial dockerfiles along with trusty. 2018-01-31 10:53:13 -08:00
Vishnu Ks be328b2c7b circleci: Create script for generating Dockerfiles.
[greg: updated Dockerfile comment]
2018-01-31 10:53:13 -08:00
Eeshan Garg c158869096 Rename tools/lib/api_tests.py to zerver/lib/api_test_helpers.py.
Now that the Markdown extension defined in
zerver/lib/bugdown/api_generate_examples depended on code in the
tools/lib/* directory, it caused the production tests to fail since
the tools/ directory wouldn't exist in a production environment.
2018-01-31 07:30:54 -05:00