Commit Graph

4584 Commits

Author SHA1 Message Date
Anders Kaseorg db476bdc51 ci: Use apt-get -y in production-upgrade test.
We currently configure ‘APT::Get::Assume-Yes’ in our custom Docker
image, but this is the only place we rely on it (outside of the
Dockerfile itself), and it’s better not to.

Also ‘apt-get remove && apt-get purge’ is the same as just ‘apt-get
purge’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-13 18:57:34 -07:00
Anders Kaseorg 47897c76a2 scripts: Use curl -f (--fail).
This makes curl exit with nonzero status on HTTP 4xx/5xx errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-13 16:47:49 -07:00
akshatdalton 2e4a333133 custom_check: Detect incorrect use of `assertTrue`.
This commit adds a check to avoid the use of assertTrue
for cases like: assertTrue(len(data) == 2).
We should use assert_length, assertGreater, or
assertGreaterEqual, whatever suits, in cases like these.
2021-07-13 13:03:38 -07:00
Christalee 69a31602ef
emoji: Correct spelling of 'judiasm' -> 'judaism'. 2021-07-13 08:35:29 -07:00
Anders Kaseorg 9fec1fb16d lint: Check *.pyi stubs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-11 09:20:19 -07:00
Anders Kaseorg 93f62b999e nagios: Replace check_website_response with standard check_http plugin.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-09 16:47:03 -07:00
Priyank Patel 519e8471c9 ts: Convert upload_widget to TypeScript. 2021-07-09 12:42:31 -07:00
Priyank Patel 261df2b4dc js: Rename muting_ui module to muted_topics_ui. 2021-07-09 10:00:45 -07:00
Priyank Patel 05c3164bb8 js: Split out muted_users_ui from muting_ui module. 2021-07-09 10:00:45 -07:00
m-e-l-u-h-a-n 781179c56a subs: Rename subs.js to stream_settings_ui.js.
We use subs as a common variable name for a collection of stream
data structure used in settings, in lot of modules. So this
rename clears a bunch of related shadowed variables.
2021-07-09 09:38:58 -07:00
Anders Kaseorg d4c8b01530 test_script: Use alphabetically first matches in find_js_test_files.
Otherwise the behavior depends on the filesystem order.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-07 15:14:00 -07:00
Tim Abbott 5872af340f templates: Rename home.html to message_feed_errors.html.
This much more clearly expresses the purpose of the remaining content
in this page.
2021-07-07 09:47:39 -07:00
aryanshridhar c6828767fa navbar: Migrate to handlebars.
This commit migrates the `navbar.html` Django template
to handlebars by creating a new file as `navbar.hbs`
within `/static/templates` which is then rendered
using `ui_init` module.

As a part of migration, we also remove the `search_pills_enabled`
and `embedded` parameters from the context attribute as they
are no longer needed now.

Fixes part of #18792.
2021-07-06 16:46:50 -07:00
PIG208 8b9011dff8 json_error: Completely remove json_error.
This completes the migration from `return json_error` to
`raise JsonableError`.
2021-07-06 15:34:33 -07:00
Eeshan Garg ef6582edb8 readthedocs: Add proper backlink to the Zulip homepage.
Now that we are starting to link this pages from the landing page's
top navigation, it makes sense to have proper backlinks to the
homepage so that there is some continuity when the user clicks on
a link that takes them to a ReadTheDocs page from the main website.
2021-07-06 10:59:59 -07:00
Priyam Seth 57340a888c compose: Extract "compose_validate.js".
This commit first moves the compose.validate() function out
with the functions that are needed by it. Then one by one
checked for which function is now not needed in compose.js.

This moves all validation related functions out of "compose.js"
to "compose_validate.js".

Splitting compose announce variables out of compose.js.

This commit moves the "user_acknowledged_all_everyone" and
"user_acknowledged_announce" out of compose.js to reduce
cyclic dependency of compose_validate on compose.js.

Moving wildcard mentions to compose_validate.

The wildcard mention settings are mostly used while validating.
Also to reduce the cyclic dependence of compose in
compose_validate, the related wildcard mentions are moved out to
compose_vaidate.js.

This also converts reset_acknowledged functions to set values
by passing values.
2021-07-05 19:21:56 -07:00
Priyank Patel 3f0110d9c0 ts: Convert ui_util module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 4fa4309338 ts: Convert loading module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel a8cdc968cc ts: Convert csrf module to TypeScript. 2021-07-05 17:04:06 -07:00
Priyank Patel 35738e148b ts: Convert padded_widget module to TypeScript. 2021-07-05 17:04:06 -07:00
Anders Kaseorg 0ae94c6051 mypy: Move configuration to pyproject.toml.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-05 17:01:32 -07:00
Anders Kaseorg ee8724e436 docs: Correct Big Blue Button to BigBlueButton.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-05 16:59:00 -07:00
Anders Kaseorg 99533b4aa2 js: Fix, and check for, non-ES5 syntax in webpack bundles.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-05 13:32:37 -07:00
Anders Kaseorg 684dad8145 tools: Use root-based absolute import for tools.lib, etc.
Mypy can’t follow absolute imports based on directories other than the
root.  This was hiding some type errors due to ignore_missing_imports.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-07-05 12:21:52 -07:00
akshatdalton 3da6f3c0af lint: Exclude `zerver/views/development/` from i18n lint rules.
This is consistent with how we handle JsonableError and friends; it
doesn't make sense for translators to spend time on strings only
visible in a development environment.
2021-07-01 14:56:53 -07:00
Anders Kaseorg 06033545eb bootstrap-awscli: Remove executable bit.
Even though this looks like an independently runnable script, it
should not be run independently: a SHA-256 mismatch will fail to stop
the script, unless it was sourced from another script that has ‘set
-e’.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-28 17:13:57 -04:00
aryanshridhar 942f4372f0 info_overlay: Render keyboard shortcuts using info_overlay.
This commits ports the `keyboard_shortcuts.html` file from
using the Django template to handlebars, essentially creating
a new file as `keyboard_shortcuts.hbs` within /static/templates
which is then rendered using info_overlays.js.

Fixes part of #18792.
2021-06-27 18:29:52 -07:00
Anders Kaseorg 0ba9114c22 install-yarn: Rewrite Yarn installer.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-27 16:58:17 -07:00
Anders Kaseorg 91bfebca7d install: Replace wget with curl.
curl uses Happy Eyeballs to avoid long timeouts on systems with broken
IPv6.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-25 09:05:07 -07:00
Anders Kaseorg d428c0e0dd lint: Add .bash extension for tools/lib/git-tools.bash.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-25 09:01:13 -07:00
sahil839 36560da0f0 modals: Add edit_fields_modal.js and edit_field_modals.hbs.
We create a new widget edit_fields_modal such that this common
framework can be used in bot-edit modal, linkifier-edit modal
and user-edit modal, which have very similar implementations.

The "edit-fields-modal-status" is used only for edit-linkifier
modal and remains empty for others, so this change does not
cause problems with other modals.
2021-06-24 16:55:22 -07:00
Anders Kaseorg 16067bc4fc ci: Remove superfluous generate-dockerfiles template system.
Dockerfiles already support variables.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-24 15:34:11 -07:00
Anders Kaseorg 3b60b25446 ci: Remove bullseye hack.
base-files 11.1 marked bullseye as Debian 11 in /etc/os-release.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-24 14:35:51 -07:00
Anders Kaseorg bf361e9951 ci: Remove uses of VERSION_CODENAME.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-24 14:35:51 -07:00
m-e-l-u-h-a-n 777f784e07 popovers: Extract user_profile_modal functions in separate module.
We had a lot of functions and click handlers that were only
involved with user profile modal and were not related to
popovers logic in any way. So we extract these functions
into a separate module `user_profile.js`.
2021-06-23 17:43:08 -07:00
Priyank Patel 043b0c6ef3 ts: Convert spoilers module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel d660f512fa ts: Convert list_util module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 6ed635b5ed ts: Convert night_mode module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel 31abcaafb8 ts: Convert ready module to TypeScript. 2021-06-22 09:14:09 -07:00
Priyank Patel c862c673af ts: Convert blueslip module to TypeScript.
We turn off the eslint no-use-before-define for TypeScript files
because it does not work correctly for types. There is already
a typescript-eslint version of it that is enabled for TS.

We also update the error handler on window to use instanceof check
for ErrorEvent instead of checking the error property.
2021-06-22 09:09:36 -07:00
Priyank Patel f7235912ff ts: Convert ui_report module to TypeScript. 2021-06-22 09:09:36 -07:00
Priyank Patel f1a0a790fe ts: Convert page_params module to TypeScript.
The plan for type annotating the page_params is to set it to
Record<string, unknown> for now and then annotate individual
properties on it as we use it in typescript modules.
2021-06-22 09:09:36 -07:00
Priyank Patel ec2ab1eb8d lint: Correctly detect the use of style attribute.
We add a exclude pattern that makes sure we don't catch two edge
cases: a variable declaration `const style =` and setting a
variable ending in style such as `require_cmd_style =`. We don't add
and exclude pattern for let declaration because it will catch lines
that modify it later in the code.

(Removed other files from exclude list that no longer needed to be
excluded from this lint rule.)
2021-06-22 09:09:36 -07:00
aryanshridhar 1db2fbcd77 stream_create: Move and rename the subscription_invites_warning modal.
Moved `subscription_invites_warning` modal to `confirm_dialog`
folder and renamed the modal to `confirm_subscription_invites_warning.hbs`
to follow the naming convention.
2021-06-21 10:36:35 -07:00
Gaurav Pandey e648ad3477 ci: Add prod upgrade step to prod suite.
This adds a check in the current production suite of
CI that upgrades a previous release of zulip server
with a newer one.

Fixes #18346.
2021-06-21 10:15:24 -07:00
Aman Agrawal 182f47b7c6 popover_menus: Extract popovers using tippy in a separate module. 2021-06-18 17:13:20 -07:00
akshatdalton 8ee652e560 semgrep: Use documentation link instead of file path. 2021-06-18 22:15:58 +00:00
Gaurav Pandey 4ca87d785b ci: Create Zulip server pre-installed docker image template.
These Docker images will be useful for testing the upgrade process
from previous Zulip major releases to master.

Fixes part of #18346.
2021-06-18 13:02:37 -07:00
Tim Abbott 76f73ae787 ci: Remove unnecessary sudo docker.
Generally, we never want to recommend sudo for an operation that can
be done as a non-root user, and it's normal to configure Docker to be
usable by normal users.
2021-06-18 13:02:18 -07:00
Tim Abbott 3e6b90a433 analytics: Explode coverage checks for analytics/views. 2021-06-17 17:39:28 -07:00
Ganesh Pawar 5e4b1e1867 deprecated_feature_notice: Migrate to handlebars. 2021-06-15 11:59:01 -07:00
Riken Shah efbde2ad01 provision: Use the `clean_unused_caches.main` function.
We currently have created a copy of the
`clean_unused_caches.main` function in
`provision_inner.py` to clean the unused caches. But as
we have now converted the script into a python file we
can directly call that function.

This commit replaces that function (introduced in adc0ed4206) with
`clean_unused_caches.main`.
2021-06-12 07:28:16 -07:00
Suyash Vardhan Mathur 001435a297 refactor: Rename and move app_filters.py.
Moved the code in zerver/templatetags/app_filters.py
to more intuitive location and name at
zerver/lib/templates.py.
2021-06-11 07:43:22 -07:00
Anders Kaseorg 9f3d1fdbdb webpack: Fix run-dev.py --minify.
‘--optimize-minimize’ no longer exists.  (Webpack 5 has
‘--optimization-minimize’.)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-10 17:26:55 -07:00
Anders Kaseorg 7b38e7c157 build-release-tarball: Use require_clean_work_tree helper.
‘git diff’ is a porcelain command that launches a pager.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-10 16:08:28 -07:00
Aman Agrawal 88454307cd recent_topics: Split into three modules.
We split recent_topics module into recent_topics_(ui + data + util).

This allows us to reduce cyclical dependencies which were
created due to large list of imports in recent topics. Also, this
refactor on its own makes sense.
2021-06-10 15:53:05 -07:00
Tim Abbott 75dbd2c80d templates: Remove logout form shared template.
It's sufficiently tiny that the shared code benefits don't justify the
cost, given that we plan to move index.html to a different templating
system soon.
2021-06-10 13:14:25 -07:00
Anders Kaseorg 7f25271d7d lint: Apply custom_check.js_rules to TypeScript too.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-10 10:35:58 -07:00
Riken Shah f95c539122 custom_check: Avoid use of assert to avoid confusion with assert.equal.
This commit bans the use of `assert` and replaces it
with `assert.ok` to avoid confusion with `assert.equal`.

Fixes #18687.
2021-06-10 09:15:57 -07:00
Anders Kaseorg 9e5f382241 production-verify: Don’t assume lengths have a decimal point.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-09 16:52:46 -07:00
Anders Kaseorg 342834ee9c python: Simplify stdio flushing using print(…, flush=True).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-09 14:05:31 -07:00
Suyash Vardhan Mathur fbf9de671a linter: Fix checking for inline refs.
The current linter disallowed the pattern
where multiple refs were present without
an additional parameter in allOf, which should
be valid.

Fixed the condition to allow the change.
2021-06-09 12:43:12 -07:00
Anders Kaseorg 3d8fc7d85f install-shfmt: Upgrade shfmt from 3.2.4 to 3.3.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 16:01:18 -07:00
Anders Kaseorg ee48dc6d33 install-shellcheck: Upgrade ShellCheck from 0.7.1 to 0.7.2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-08 16:01:14 -07:00
Anders Kaseorg 643f02bd00 import_emoji_names_from_csv: Convert percent formatting to "".format.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-06-07 17:57:51 -07:00
Mateusz Mandera 01818c1825 docs: Add additional missing detail to the oneclick app release doc. 2021-06-03 09:35:34 -07:00
Mateusz Mandera 1fdf09cfac docs: Update link to image check script in digitalocean tools repo.
The old link doesn't work, the script was moved to
https://raw.githubusercontent.com/digitalocean/marketplace-partners/master/scripts/99-img-check.sh
2021-06-03 09:35:34 -07:00
Tim Abbott a49e685d97 i18n: Adjust Transifex sync-translations download mode.
It appears that some server-side change to Transifex resulted in the
"onlytranslated" mode deleting some (all?) strings from django.po files that
were not translated.

Testing determined that the "translator" mode appears to now be the
only mode that works with both our django.po and translations.json
files (We want to avoid both copying the English strings and deleting
strings), so we're switching to that.

Background is available here:
https://chat.zulip.org/#narrow/stream/3-backend/topic/4.2Ex.20branch.20translations.20sync/near/1187324
2021-06-02 09:48:58 -07:00
Mateusz Mandera e17758f8ad auth: Implement a generic OpenID Connect backend.
Fixes #11939.
2021-05-28 09:43:06 -07:00
Alex Vandiver 87a109e3e0 puppet: Pull in pinned puppet modules.
Using puppet modules from the puppet forge judiciously will allow us
to simplify the configuration somewhat; this specifically pulls in the
stdlib module, which we were already using parts of.
2021-05-27 21:14:48 -07:00
Gilbert Bishop-White b43cab3e3b install-shfmt: Add aarch64 support.
This fixes a problem provisioning on an ARM64 computer. Tested by
running on M1 Mac.

Fixes part of #18614
2021-05-27 16:01:42 -07:00
Gilbert Bishop-White 11257933b3 provision: Add support for aarch64 ubuntu/debian.
Install prerequisite needed on aarch64, as pip package has to build
from scratch.Tested by running on M1 Mac.

Fixes part of #18614
2021-05-27 16:01:42 -07:00
Gilbert Bishop-White d808dca28f install-shellcheck: Add aarch64 support.
This fixes a problem provisioning on an ARM64 computer. Tested by
running on M1 Mac.

Fixes part of #18614
2021-05-27 16:01:42 -07:00
Steve Howell 2dd7a8864c node tests: Get 100% coverage on rendered_markdown. 2021-05-25 15:30:40 -07:00
Adam Birds 9aab03654e ci: Update CI to test once with custom db name and user.
Update CI to test once with a custom db name and user so we can test
both scenarios of a custom dbname/user and the default "zulip".
2021-05-25 13:56:05 -07:00
Adam Birds 73b4ac5793 debugging: Print process_fts_updates log in CI. 2021-05-25 13:56:05 -07:00
Alex Vandiver 4f017614c5 nagios: Replace check_fts_update_log with a process_fts_updates flag.
This avoids having to duplicate the connection logic from
process_fts_updates.

Co-authored-by: Adam Birds <adam.birds@adbwebdesigns.co.uk>
2021-05-25 13:56:05 -07:00
Sumanth V Rao 83a2479a5a build_pygments_data: Reprioritize and categorize pygment language codes.
We now organize the pygment language codes into meaningful categories
- default, custom and aliases.

Further the `lang.json` list now contains a dataset extracted from the
"language" section of https://insights.stackoverflow.com/survey/2020
and is prioritized based on current language trends.
2021-05-24 23:15:39 -07:00
Anders Kaseorg 9d0340c7a8 rundjangoserver: Filter stdout instead of forking the code.
We failed to update this fork for the Django 3.2 upgrade.  Unfork it
so that’s not something we need to remember to do.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-24 18:54:47 -07:00
Alex Vandiver 48a56f8b9a aws: Turn on detailed monitoring by default. 2021-05-23 13:29:23 -07:00
Alex Vandiver 6ef497f002 aws: Let us pull all defaults from an ASG and launch template. 2021-05-23 13:29:23 -07:00
Alex Vandiver 2198dbb8c1 aws: Allow per-role overrides of config. 2021-05-23 13:29:23 -07:00
Alex Vandiver 2a247391ab aws: Shorten the tag names. 2021-05-23 13:29:23 -07:00
Riken Shah 51e24519b8 refactor: Rename `panels.js` to `navbar_alerts.js` as it better explains it. 2021-05-21 17:49:12 -07:00
Alex Vandiver e2d8c97463 update-prod-static: Ensure that it is run as the zulip user. 2021-05-21 16:52:49 -07:00
Abhijeet Prasad Bodas 0ec905ed52 custom_check: Enforce use of assert_length helper. 2021-05-19 11:55:56 -07:00
Tim Abbott 3af0485d84 ci: Unpack installation tarball under /root/.
This ensures that we exercise the fact that the Zulip installer may be
unpacked to a directory that may not be world-readable.

bc45525369 fixed a recent regression in
this behavior that would have been caught by this commit.
2021-05-14 14:31:00 -07:00
Anders Kaseorg e015f3ed7d docs: Correct “webapp” to “web app”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-14 13:15:38 -07:00
Tim Abbott 4fd9a971ed lint: Allow changelog link to latest changelog. 2021-05-13 12:36:56 -07:00
Anders Kaseorg 668b5137b0 version: Display Zulip version in About Zulip dialog.
We record Git details about the merge-base with upstream branches in
the zulip-git-version file, if the upstream repository is available.

Note that the first Git upgrade after merging the parent commit will
not include the merge-base details, since the upstream repository will
not have been available.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-13 11:36:12 -07:00
PIG208 9b48a36b91 tools: Add support to generating bot avatars for non-webhook integrations.
New bot avatars are generated with this tool. Having the avatars generated,
we can run generate-integration-docs-screenshot to generate the doc
screenshots.

Fixes: #17792
2021-05-10 17:50:32 -07:00
PIG208 540072e860 tools: Support sending mock messages for non-webhook integrations.
Non-webhook integrations should have fixtures containing mock messages
in json format with fields "subject" and "body" indicating the topic
and content respectively.
2021-05-10 17:50:32 -07:00
Riken Shah cf9fb1cf80 puppeteer_tests: Show filename when failed for quicker debugging. 2021-05-10 15:08:11 -07:00
Anders Kaseorg 544bbd5398 docs: Fix capitalization mistakes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-10 09:57:26 -07:00
Tim Abbott 1d9b5ffa92 lint: Fix badly quoted strings tagged for translation.
We also remove an aria-label on a placeholder that matches the input
element's actual label field.
2021-05-09 20:16:28 -07:00
Anders Kaseorg 9e243c74ed shell: Replace ‘which’ utility with ‘command -v’ shell builtin.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-07 08:54:41 -07:00
Anders Kaseorg 405bc8dabf requirements: Remove Thumbor.
Thumbor and tc-aws have been dragging their feet on Python 3 support
for years, and even the alphas and unofficial forks we’ve been running
don’t seem to be maintained anymore.  Depending on these projects is
no longer viable for us.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-05-06 20:07:32 -07:00
LoopThrough-i-j adc646adb8 lint: Set repository variable in tools/commit-message-lint. 2021-05-06 08:13:41 -07:00
Flávio Prado 0c78131139 settings: Import LDAP settings in prod_settings_template.
Currently users that try to deploy Zulip through docker has errors
because LDAP group search configuration can't be automated.

Reverts a hunk of f5197518a9.
2021-05-05 10:55:27 -07:00
Tim Abbott 638ffb36a4 refactor: Move click handlers to compose_closed_ui.js. 2021-05-04 20:55:58 -07:00
Sumanth V Rao a510dac024 settings_playground: Add UI to create a new playground.
The design of the form is similar to the linkifiers page
and is styled similarly.

The introduction text for "Code playgrounds" is improved
with more details and examples.

Also, we can remove the hardcoded playground and the fix
we had previously done to prevent breaking the hardcoded
playground.
2021-05-04 11:39:33 -07:00
Alex Vandiver eda9ce2364 locale: Use `C.UTF-8` rather than `en_US.UTF-8`.
The `en_US.UTF-8` locale may not be configured or generated on all
installs; it also requires that the `locales` package be installed.
If users generate the `en_US.UTF-8` locale without adding it to the
permanent set of system locales, the generated `en_US.UTF-8` stops
working when the `locales` package is updated.

Switch to using `C.UTF-8` in all cases, which is guaranteed to be
installed.

Fixes #15819.
2021-05-04 08:51:46 -07:00
Mateusz Mandera 1d9fb4f988 django: Upgrade Zulip to Django 3.2 LTS.
This is a straightforward upgrade in terms of changes needed.

Necessary changes were:
- Set `DEFAULT_AUTO_FIELD`
  https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys

- `The default_app_config application configuration variable is deprecated, due
  to the now automatic AppConfig discovery.`
  https://docs.djangoproject.com/en/3.2/releases/3.2/#automatic-appconfig-discovery

To handle this one, we can remove default_app_config from
zerver/__init__.py because it satisfies what release notes describe in
https://docs.djangoproject.com/en/3.2/releases/3.2/#automatic-appconfig-discovery:
"Most pluggable applications define an AppConfig subclass in an apps.py
submodule. Many define a default_app_config variable pointing to this
class in their __init__.py.  When the apps.py submodule exists and
defines a single AppConfig subclass, Django now uses that configuration
automatically, so you can remove default_app_config."

An important note is that rebuild-test-database needs to be run after
this upgrade in dev environment - if tests are run with test db that was
built on the previous version, they will fail due to a mysterious bug
(?), where changing attributes of a user and .save()ing after logging in
in the test via self.login_user, causes getting logged out - the next
requests via self.client_get etc. are unauthed for some reason,
unless self.login_user is called again. This behavior is no longer
exhibited upon rebuilding the test db - and I can't reproduce it in
production or dev db. So this can likely be reasonably dismissed as some
quirk of the test client system that won't be relevant in the future and
doesn't impact production.
2021-05-03 08:36:22 -07:00
pilgrim2308 a74b52db22 UI: Add Zulip version in gear menu.
Currently only enabled in development, since the exact details don't
seem right..

Co-Author-By: Signior-X <b19188@students.iitmandi.ac.in>
Co-Author-By: Aman Agrawal <amanagr@zulip.com>

Implements UI for #8005.
2021-04-30 17:58:08 -07:00
Tim Abbott 3116f72894 tools/i18n: Add support for branch parameters.
One could do other things with this, but what I expect us to do is
pass `-b {branch}`.
2021-04-30 16:37:01 -07:00
Anders Kaseorg bf447a726f test-documentation: Clean up fixed HTML validation ignore patterns.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-30 15:49:30 -07:00
Greg Price da8763d889 tools: Avoid `readlink -f` in *-pull-request scripts.
This is a feature of GNU readlink that isn't in the BSD readlink
found on macOS.

For using this and other GNU coreutils features in our scripts in
general, we could use a solution like mobile's tools/lib/ensure-coreutils.sh
to get GNU coreutils on the PATH -- check if it's there already,
if not then try to find a Homebrew install of it and use that, if not
then print a helpful message.

But even then there'd be a bootstrapping problem of how to find
ensure-coreutils.sh .  That involves exactly the same problem as we
have for finding git-tools.sh in these lines.  So in fact in mobile
for the task of finding ensure-coreutils.sh in the first place, we
do without `readlink -f` anyway.

The one consequence of this behavior-wise is that if you make a
symlink somewhere that points directly at that script (say in your
`~/bin/`), and try to run it using that symlink, it won't work.
(It'll still work just fine if there are symlinks somewhere higher
up in the paths involved -- just not for the script itself.)
An ideal CLI program really should support that, I think, but
lacking a better idea, this seems an acceptable compromise.
2021-04-30 14:57:13 -07:00
tushar912 c6671a67dd tools: Add tools/build-docs --clean option.
Currently the tools/build-docs was slow
because the clean option was rebulding everything.
But this is only required if one wants the left
sidebar to update.

So now set the default to exclude clean and
add clean option only if --clean is passed.

Also a warning is displayed if clean option is
not passed that the left sidebar won't update.

Fixes #17961.
2021-04-29 21:01:28 -07:00
tushar912 94afc72764 docs: Rewrite tools/build-docs in python.
Change the script to python. This is done
for the following reasons.
* It enables us to use the sanity_check.
* Later when we add warning to include
--clean flag we can use the pre-existing
WARNING from zulip_tools rather than using
terminal color codes.

TODO: Currently this script is slow as the
clean option is expensive so instead use only
html by default and clean only if --clean
option is passed.

Part of #17961.
2021-04-29 21:01:14 -07:00
100RABHpy 21be0ef445 openapi: Refactor hacky openAPI curl test.
Fixes #17795

In PR #17014, we added support for deactivate-own-user.
And while doing so, we first deactivated the client and
then reactivated it. But this implementation is a bit
hacky.

So, to fix this, we're now deactivating a test_user so that
we don't have to reactivate it. We did so by changing the value
of authentication_line.

As we want to keep endpoint code out of the
“test_curl_examples”, we changed the value of
authentication_line in `curl_param_value_generators.py`.

To work this out, we create a new global variable named
AUTHENTICATION_LINE in “curl_param_value_generators.py”
and change its value in function “deactivate_own_user” and
to use this change in “test_curl_examples,” we import
AUTHENTICATION_LINE.

AUTHENTICATION_LINE is of list data type because we want a
pointer to original mutable object so that changes made during
run time show across the module. Another way to do this is to change
the way we import variable, but that will be inconsistent to
the way we had in all other files.

To remove confusion between AUTHENTICATION_LINE and
authentication_line we renamed authentication_line
to default_authentication_line.
2021-04-28 15:49:35 -07:00
Tim Abbott 2d9631191e tools: Fix mypy errors with generate-integration-docs-screenshot.
3f4d0f72fd adjusted the types in
preparation for extending the functionality, but only in later commits
that are not merged yet did it make these updates to the types.
2021-04-28 08:47:38 -07:00
PIG208 3f4d0f72fd tools: Create get_fixture_info to support non-webhook integrations. 2021-04-28 08:16:51 -07:00
Abhijeet Prasad Bodas 2c4505d322 settings/muted-topic: Move list-create code to designated file.
This code better fits in `settings_muted_topics`.
2021-04-27 17:53:06 -07:00
Anders Kaseorg 6060d0d364 docs: Add missing space to compound verbs “log in”, “set up”, etc.
Noun: backup, checkout, cleanup, login, logout, setup, shutdown, signup,
timeout.

Verb: back up, check out, clean up, log in, log out, set up, shut
down, sign up, time out.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-26 09:31:08 -07:00
Anders Kaseorg 178736c8eb docs: Fix spelling errors caught by codespell.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-26 09:31:08 -07:00
Anders Kaseorg bf056c8990 js: Extract password_quality module; remove zxcvbn from globals.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Anders Kaseorg 84f1e27516 js: Consistently use main jquery-validation module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Anders Kaseorg 41dd50948a js: Consistently use ES module from SimpleBar.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-24 13:08:52 -07:00
Riken Shah 0e5f6c21ad refactor: Split dev related code from `auth.py` into `dev_login.py`.
This refactor will help us make our development-related authentication
code to avoid production security impact.
2021-04-23 15:11:44 -07:00
Alex Vandiver ec12a6128a scripts: Add a start-server as well.
In general, `./scripts/restart-server` will already work in any
circumstance where the server is already stopped and needs to be
started.  However, it will output a couple minor warnings, and it is
not readily obvious that it *will* work correctly.

Add an alias for `restart-server` named `start-server`, for
parallelism with `stop-server`, which omits the steps of
`restart-server` which would stop the server first.
2021-04-21 10:24:08 -07:00
Alex Vandiver 476524c0c1 scripts: Add a script to stop the server.
Using `supervisorctl stop all` to stop the server is not terribly
discoverable, and may stop services which are not part of Zulip
proper.

Add an explicit tool which only stops the relevant services.  It also
more carefully controls the order in which services are stopped to
minimize lost requests, and maximally quiesce the server.

Locations which may be stopping _older_ versions of Zulip (without
this script) are left with using `supervisorctl stop all`.

Fixes #14959.
2021-04-21 10:24:08 -07:00
Abhijeet Prasad Bodas bbbaa109ec settings: Add UI page for managing muted users.
This page is temporarily hidden except in the development environment,
because the "muted users" feature is incomplete.
2021-04-21 10:17:44 -07:00
Anders Kaseorg dd3fa4ac52 templates: Mark all void tags as self-closing.
This reverses the policy that was set, but incompletely enforced, by
commit 951514dd7d.  The self-closing tag
syntax is clearer, more consistent, simpler to parse, compatible with
XML, preferred by Prettier, and (most importantly now) required by
FormatJS.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-21 09:49:34 -07:00
Sumanth V Rao 0ecf5d0e83 settings_playground: Add UI to list all playgrounds.
Adds a setting UI to list all configured playgrounds
in a realm. The filter functionality can be used to
search playgrounds by its name or language.

Default sort is provided on the 'pygments_language'
field.

Front tests added to maintain server_event_dispatch
coverage. The `settings_playgrounds.js` file is added
to coverage exclusion list since it is majorly UI
based and will be tested using puppeteer tests (in
following commits).
2021-04-19 12:54:59 -07:00
Sumanth V Rao 32390e0c87 playgrounds: Hook up configured playgrounds to be used in code blocks.
To prevent breaking of the hardcoded playgrounds, we resort
to checking if realm_playgrounds is empty and falling back
to the hard-coded list if so. This logic is removed in the
followup commit which introduces the UI to add a playground.
2021-04-19 11:23:10 -07:00
Adam Birds 3b974d9ef7 tools: Add support for generating integration screenshots remotely.
I have added support for generating integration screenshots remotely by
adding a `realm_uri` parameter to `tools/message-screenshot.js` which we
then pass `realm.uri` to from within
`tools/generate-integration-docs-screenshot`.
2021-04-19 10:44:43 -07:00
Riken Shah 14b01343d9 webpack: Introduce `webpack.dev-asset.json`.
This commit will now allow development-only pages to
use development-only packages without breaking the
production build.
2021-04-19 10:31:39 -07:00
Riken Shah c3601d7e3e lint: Ensure non-dev templates entrypoint name doesn't start with `dev`.
Only development-related templates entrypoint name
should start with `dev`.
2021-04-19 10:27:33 -07:00
Riken Shah bd9e6ae97e refactor: Move dev-only templates to `templates/zerver/development`.
This a prep commit for adding a check to lint to ensure
only development-related templates entrypoint name
starts with `dev`.
2021-04-19 10:25:05 -07:00
Adam Birds e27268837b tools: Have `optimize-svg` do the optimization automatiically.
I have made `tools/setup/optimize-svg` do the SVG optimization
automatically rather than just telling you the command to run if they
need optimizing. This included adding a `--check` parameter to use in
CI to only check as we previously did rather than actually running the
optimization.

I have also made `tools/setup/optimize-svg` execute
`tools/setup/generate_integration_bots_avatars.py` once it has run the
optimization to ensure it is always ran.

This makes it one less command to run when creating an integration,
but also means that we catch instances where a PNG has just been
copied into the `static/images/integrations/bot_avatars` folder as the
only instance where this won't be run is if `optimize-svg` has not
been run which would be caught in CI.

Fixes #18183. Fixes #18184.
2021-04-19 10:16:54 -07:00
Wesley Aptekar-Cassels da0c616b69 shared: Move PollData into shared. 2021-04-19 06:34:08 -04:00
Adam Birds 5f0211285e tools: Update run-dev.py to output right subdomain if on Zulip droplet.
I have updated `tools/run-dev.py` to output the correct subdomain such as
`http://zulip.username.zulipdev.org` so that the user knows the correct
subdomain to access the Zulip Dev realm on.
2021-04-16 14:57:36 -07:00
Anders Kaseorg 36e938bf9f requirements: Upgrade Python requirements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-15 21:47:33 -07:00
Gaurav Pandey 303e7b9701 ci: Add Debian bullseye to production test suite. 2021-04-15 21:38:31 -07:00
Gaurav Pandey feb720b463 install: Add beta support for debian bullseye for production.
This won't work on a real bullseye system until Bullseye actually
officially releases.

Fixes part of #17863.
2021-04-15 21:38:31 -07:00
Gaurav Pandey 78524d4f87 provision: Add support for debian bullseye.
Fixes part of #17863.
2021-04-15 21:38:31 -07:00
Anders Kaseorg e7ed907cf6 python: Convert deprecated Django ugettext alias to gettext.
django.utils.translation.ugettext is a deprecated alias of
django.utils.translation.gettext as of Django 3.0, and will be removed
in Django 4.0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-15 18:01:34 -07:00
Tim Abbott 208721b3d7 left sidebar: Fix misleading "search streams" label.
This widget only filters the user's subscription -- it's only suggest
public streams that the user is not subscribed to.  "Filter" is the
correct label for a widget with this use case.
2021-04-15 15:36:05 -07:00
Anders Kaseorg c66a848c97 lint: Remove custom // spacing rule.
Commit 7f89cb9535 (#17822) enabled the
ESLint spaced-comment rule.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:45:59 -07:00
Anders Kaseorg a5511b3fbb lint: Update lint rules for FormatJS migration.
FormatJS already checks many of the invariants we previously had to
enforce ourselves.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 24646907dc notifications: Convert capitalization-exempt messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg d761077dac compose: Convert compose_error messages to FormatJS.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 17:41:10 -07:00
Anders Kaseorg 9a15541e0b Fix canonical name of U+1F637 FACE WITH MEDICAL MASK emoji.
Fixes #18116.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-13 09:03:04 -07:00
Adam Birds 4d9f161e0f tools: Suppress errors for github.com links.
I have suppressed errors for github.com by adding an function to
exclude domains as well as urls; this is necessary because GitHub has
marked this tool's User-Agent as a blocker crawler.

I have also suppressed reoccurring url errors that do definitely exist.

Fixes #17928.
2021-04-09 12:25:23 -07:00
Tim Abbott d31f01bd0f tools: Improve output from check-capitalization.
Ideally, we'd print line numbers etc., but that's complicated because
the `translation.json` format doesn't include them, and usually it's
easy to find strings because you just added them anyway.

But adding a bit more of a `git grep` hint should help.

Fixes #14321.
2021-04-09 11:09:12 -07:00
Anders Kaseorg 4a7de53554 webpack: Fix tools/webpack for webpack-cli 4 when inotify_broken.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-09 01:07:31 -07:00
Anders Kaseorg 2ce24bcd2b dependencies: Upgrade webpack-cli from 3.3.12 to 4.6.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-07 18:43:36 -07:00
Aman Agrawal 9c6f5d5946 tippyjs: Add library to be used for showing tooltips.
Our aim is to use this library to remove use of bootstrap-tooltip
for showing popovers and tooltips. This will remove our
dependency on bootstrap for showing tooltips. Thus, bootstrap
can be upgrade more independently.
2021-04-07 01:16:28 -07:00
Tim Abbott e51344ab2d run-dev.py: Fix incorrectly printed hostname for droplets.
Because the logic in print_listeners doesn't have access to computed
settings in dev_settings.py, we need to duplicate the special
IS_DEV_DROPLET logic for computing the default hostname.

There's still a secondary problem that this URL 404s.
2021-04-06 11:16:16 -07:00
Anders Kaseorg 3c41db7f1a dependencies: Upgrade to webpack-bundle-tracker 1.0.0-alpha.1.
This also seems unmaintained, but is, at least, released.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 09:31:35 -07:00
Anders Kaseorg 738532ba51 requirements: Remove django-webpack-loader.
It does not seem like an official version supporting Webpack 4 (to say
nothing of 5) will be released any time soon, and we can reimplement
it in very little code.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-06 09:31:35 -07:00
Anders Kaseorg f81cc16a0f templates: Add {{#let}} block helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-04-05 17:24:09 -07:00
Aman Agrawal 5e83965e80 giphy: Use GIPHY web SDK to allow inserting GIFs in compose box.
We use GIPHY web SDK to create popover containing GIFs in a
grid format. Simply clicking on the GIFs will insert the GIF in the compose
box.

We add GIPHY logo to compose box action icons which opens the GIPHY
picker popover containing GIFs with "Powered by GIPHY"
attribution.
2021-04-05 15:04:49 -07:00
Vishnu KS f00c13d303 actions: Improve the secrets of one click release action. 2021-04-05 14:40:45 -07:00
shanukun 0bf067b681 refactor: Make acting_user a mandatory kwarg for bulk_add_subscriptions. 2021-04-02 14:44:41 -07:00
Tim Abbott 0723ba4cc4 sanity_check: Improve output for manual installation.
We should still display the `source` advice when not in Vagrant or a
Droplet, since that's an important hint for anyone using local
installation on Linux.

We move the "If you are using Vagrant..." text a bit after to
highlight things nicely for folks who are running tools outside
Vagrant.

Also tighten text to avoid line-wrapping on an 80 character console.
2021-04-01 10:54:56 -07:00
Riken Shah 7d64fc9bff puppeteer_tests: Display the number of tests completed after each run. 2021-04-01 07:47:26 -07:00
Riken Shah f6998d6fee puppeteer_tests: Remove sequential numbers from test files.
The only downside of this is that it makes it harder to control the
order of these tests; which isn't that important.  And the structure
of naming each with its test order fundamentally requires renaming
files when adding/deleting tests, so if we want to control the default
test order, we'd be better off doing that by just hardcoding a list in
the test runner code.
2021-04-01 07:46:13 -07:00
YashRE42 e05935a292 narrow_banner: Add test for empty_narrow_multi_private_message case.
This commit also marks narrow_banner.js as having 100% node test
coverage.
2021-04-01 07:38:39 -07:00
Riken Shah 08212ef74a puppeteer_tests: Remove login test.
This commit deletes the `01-login.ts` test because it was
redundant, We are already checking for log-in in all the
other tests.
2021-03-31 16:55:54 -07:00
Alex Vandiver 0023d561dd ci: Switch to hosting the CI images under Zulip on Dockerhub. 2021-03-31 16:54:34 -07:00
m-e-l-u-h-a-n aea31eb31f api: Add REALM_DEACTIVATED error code.
In `validate_account_and_subdomain` we check
if user's realm is not deactivated. In case
of failure of this check, we raise our standard
JsonableError. While this works well in most
cases but it creates difficulties in handling
of users with deactivated realms for non-browser
clients.

So we register a new REALM_DEACTIVATED error
code so that clients can distinguish if error
is because of deactivated account. Following
these changes `validate_account_and_subdomain`
raises RealmDeactivatedError if user's realm
is deactivated.

This error is also documented in
`/api/rest-error-handling`.

Testing: I have mostly relied on automated
backend tests to test this.

Fixes #17763.
2021-03-31 08:46:13 -07:00
m-e-l-u-h-a-n 2eeb82edba api: Add USER_DEACTIVATED error code.
In validate_account_and_subdomain we check if
user's account is not deactivated. In case of
failure of this check we raise our standard
JsonableError. While this works well in most
cases but it creates difficulties in handling
of deactivated accounts for non-browser clients.

So we register a new USER_DEACTIVATED error
code so that clients can distinguish if error
is because of deactivated account. Following
these changes `validate_account_and_subdomain`
raises UserDeactivatedError if user's account
is deactivated.

This error is also documented in
`/api/rest-error-handling`.

Testing: I have mostly relied on automated
backend tests to test this.

Partially addresses issue #17763.
2021-03-31 08:46:13 -07:00
YashRE42 b56ad453b3 message_flags: Add coverage for unstar_all_messages call.
This commit also marks message_flags.js to have 100% coverage.
2021-03-30 14:40:13 -07:00
Mateusz Mandera f329878376 migrations: Subscription.is_user_active denormalization - step one.
This adds the is_user_active with the appropriate code for setting the
value correctly in the future. In the following commit a migration to
backfill the value for existing Subscriptions will be added.

To ensure correct user_profile.is_active handling also in tests, we
replace all direct .is_active mutation with calls to appropriate
functions.
2021-03-30 09:19:03 -07:00
Anders Kaseorg d43ac7357a js: Move current_msg_list, home_msg_list to ES6 module message_lists.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 18:23:47 -07:00
Anders Kaseorg 056b715765 ci: Remove 2>&1 redirection.
We had used 2>&1 to redirect stderr to stdout so it could be piped
into ts, but commit dd3cdd6ec5 (#17611)
removed ts, so we no longer need the redirection.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 14:52:06 -07:00
PIG208 f42729ab0c tools: Fix screenshot capturing script to capture the correct area.
As the hotkey might cause the page to be scrolled, thus capturing
the wrong area, I view the message by id instead of using
'#narrow/near' and remove the 'selected_message' class from the
message box to remove the selection highlight on it.

Fixes: #17878
2021-03-29 14:43:10 -07:00
Anders Kaseorg 16a4a46934 lint: Suppress Ruby warnings from puppet on Ubuntu 20.04.
puppet    | /usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
puppet    | /usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
puppet    | /usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
puppet    | /usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete

https://bugs.launchpad.net/ubuntu/+source/puppet/+bug/1875848
https://tickets.puppetlabs.com/browse/PUP-10247

See also commit 3971824d04 (#14571).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-29 12:41:34 -07:00
Gaurav Pandey 371cdf9dc1 production_suite: Add debian production install to production suite.
We support Debian as an OS for setting up the Zulip server. But the CI
does not run on pull request to test the setting up of the server on
Debian. Hence, add the check to CI.
2021-03-28 16:04:03 -07:00
Steve Howell c67f82b073 refactor: Extract narrow_banner module.
This is a mostly verbatim extraction.

I re-phrased one line of code to work around a lint
false alarm. (Look for `preamble` in the diff.)

There are about 8 lines missing coverage here, so
the new module might be a good candidate to get
100% line coverage on.

Before this change, you would need to remove 74
edges from our dependency graph to make it
acyclic. Now it's 72.
2021-03-28 15:55:55 -07:00
Anders Kaseorg 62c5782f66 message-screenshot: Update for removal of navigate global.
Commit 0200f48a12 (#17407) removed the
navigate global variable.  Use the K hotkey instead of evaluating
navigate.up().

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 16:34:29 -07:00
Vishnu KS 79586cc466 github: Create action for generating DigitalOcean one click app image. 2021-03-26 16:01:18 -07:00
Anders Kaseorg 38ffd47b90 js: Convert static/js/page_params.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 10:17:56 -07:00
PIG208 36e90195e0 static: Move click handlers for alert-box to a separate module.
ui_init is also modified to ensure that the click handlers will still
be correctly initialized.
2021-03-26 09:24:41 -07:00
Anders Kaseorg 2831f9b60e install-shfmt: Upgrade shfmt from 3.2.2 to 3.2.4.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-26 08:51:16 -07:00
Tim Abbott f5b7e5d934 puppeteer_tests: Use POST for flush_caches call. 2021-03-25 12:58:36 -07:00
Riken Shah 99f8be6a12 puppeteer_tests: Reset test environment after each run.
When running some tests multiple times in the same call,
were failing because of the data duplication.

This commit resolves that issue by resetting the test
environment (i.e: Re-cloning test database and clearing
cache) after each run.

Fixes #17607.
2021-03-25 12:58:36 -07:00
Abhijeet Prasad Bodas 423770f189 refactor: Extract starred_messages_ui.js module.
This is a direct code move which will allow us
to enforce 100% coverage on the data handling
parts of starred_messages.js.
2021-03-25 02:26:44 -07:00
Suyash Vardhan Mathur d3a3c6898c api docs: Add documentation of deactivate-own-user endpoint.
Currently, there was no markdown page for deactivate-own-user API
endpoint. Created deactivate-own-user.md for the API page and
created a new owner client in test-api to reactivate the client
deactivated during testing.

Also changed endpoint name from deactivate-my-account to
deactivate-own-user, for better consistency with other endpoints.

Fixes #16163.
2021-03-25 01:05:44 -07:00
Anders Kaseorg 3b4cb899b6 zanitizer: Reformat with perltidy.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-24 12:12:04 -07:00
Vishnu KS 965a71a332 droplets: Remove obvious comments from create.py. 2021-03-23 14:05:34 -07:00
Vishnu KS b1a26c7123 droplets: Rename get_keys to get_ssh_public_keys_from_github. 2021-03-23 14:05:34 -07:00
Vishnu KS 36ba00f65a droplets: Rename fork_exists to assert_user_forked_zulip_server_repo. 2021-03-23 14:05:34 -07:00
Vishnu KS c1d80561a6 droplets: Add support for creating prod droplets. 2021-03-23 14:05:34 -07:00
Vishnu KS fa623dbd62 droplets: Make assert_droplet_does_not_exist take droplet_name as argument. 2021-03-23 14:05:34 -07:00
Vishnu KS 13b9cf200b droplets: Make print_completion take droplet_domain_name instead of username. 2021-03-23 14:05:34 -07:00
Vishnu KS 33f51305eb droplets: Rename username argument to record_name in create_dns_record. 2021-03-23 14:05:34 -07:00
Vishnu KS 3407627c46 droplets: Rename exit_if_droplet_exists to assert_droplet_does_not_exist. 2021-03-23 14:05:34 -07:00
Vishnu KS ca9d82fc06 droplets: Rename user_exists to assert_github_user_exists. 2021-03-23 14:05:34 -07:00
Vishnu KS 656fa15da1 droplets: Make create_droplet take droplet name instead of username. 2021-03-23 14:05:34 -07:00
Vishnu KS 4ba16d6ed9 droplets: Create get_ssh_keys_string_from_github_ssh_key_dicts function. 2021-03-23 14:05:34 -07:00
YashRE42 5b0db2e7ed templates.js: Remove unused "plural" helper.
This helper was added in eac6463031 and
used by the "message.handlebars" file. This is no current call for
this helper in the codebase, hence it is removed to improve coverage.

This commit also marks template.js to have 100% test coverage.
2021-03-23 10:46:04 -07:00
Abhijeet Prasad Bodas f17a52b2f3 refactor: Use confirm_dialog for unstar-all-messages.
This replaces the separate modal shown on clicking
"Unstar all messages" from the left sidebar to use
the confirm_dialog widget instead.
2021-03-23 00:17:15 -07:00
shanukun 7aa89289a3 check_schema: Ignore operation field in schema validation for openapi.
In the openapi specs, the update_message_flags event is documented as
having a `operation` (deprecated) field, alongside the modern `op`.

This causes check_schemas warnings like this:

    NEED SCHEMA to match OpenAPI update_message_flags_add_add_event
    NEED SCHEMA to match OpenAPI update_message_flags_remove_remove_event

as check_schemas uses both `op` and `operation` for constructing the
event name.

Being deprecated (and really only still there for
backwards-compatibility with the original error of having it present),
`operation` will be removed eventually, therefore we can safely
ignore it from being used in openapi schema validation.

Part of #17568.
2021-03-22 23:45:42 -07:00
Tim Abbott 6312401e58 i18n: Tweak makemessages for Django 3.1 parameters.
Apparently the default for how this works changed in the Django 2.1 to
3.1 upgrade.
2021-03-22 19:37:20 -07:00
Ganesh Pawar c1628e7605 provision: Upgrade support for Fedora to version 33.
Note that the `overwrite_symlink` changes fix a bug introduced in
5c20ee998c, that we need root
permissions to do those operations.
2021-03-22 19:34:18 -07:00
Anders Kaseorg 91f048c056 gitlint-rules: Remove convoluted binary search for imperative forms.
This also fixes the suggestions for the following words: disabled,
disables, disabling, implemented, implementing, implements, kept,
made, took, using.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-22 18:08:01 -07:00
Steve Howell 1cee29c2d1 refactor: Extract stream_bar.decorate.
This makes input_pill no longer depend on
stream_data and stream_color, and it
probably reduces some other dependencies.
2021-03-22 13:21:56 -07:00
YashRE42 0b6b5f421f reload_state: Add 100% test coverage.
This commit adds a new reload_state.js file to node_tests/ which
completes the missing coverage from reload_state.
2021-03-21 17:14:28 -07:00
Anders Kaseorg 0d218a4b76 eslint: Enable @typescript-eslint/consistent-type-imports.
TypeScript type-only imports will probably become important eventually
for reducing our circular import problem.

https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-18 17:26:19 -07:00
Tim Abbott 6d506ed40a node tests: Mark starred_messages as fully covered. 2021-03-18 16:32:12 -07:00
YashRE42 2b03a74d97 channel: Add while_reloading test cases for 100% coverage.
The branches that depended on reload_state were introduced after a
refactor in 'presence' and never had relevant test cases added.
2021-03-18 10:09:22 -07:00
Anders Kaseorg afbcdc38f4 test-js-with-puppeteer: Propagate --skip-provision-check to test server.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 18:26:15 -07:00
Anders Kaseorg 129ea6dd11 nginx: Consistently listen on IPv6 and with HTTP/2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 17:46:32 -07:00
Anders Kaseorg 3ef6f6e2e2 js: Convert static/js/blueslip.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-17 08:47:15 -04:00
Aman Agrawal 76c69b943c github_actions: Explode backend and frontend tests.
We basically move all the tests from backend and frontend test
files to zulip-ci workflow. This results in GitHub Actions
nicely displaying all the tests separately.
2021-03-16 15:11:21 -07:00
Aman Agrawal 2b23609f9a ci: Remove unused circleci config file and update codebase.
We have disabled CircleCI and are using GitHub Actions for automated
testing.

docs: Changed context from CircleCI to Github Actions and wrote
some documentation specific to GH Actions.

tools: Replaced env checks for CIRCLECI with GITHUB_ACTION.

README: Use GitHub Actions build status badge.
2021-03-16 15:11:21 -07:00
Aman Agrawal 59c8f3ed92 ci: Use general terms for CircleCI.
GitHub Actions supports doing more than just CI,
and so in some contexts it's less obvious that we're
talking about just the CI if we refer to it instead of CircleCI.
2021-03-16 14:56:43 -07:00
Riken Shah d6307cc907 puppeteer_test: Add support to run tests with Firefox.
This commit introduces the `--firefox` argument,
which will allow us to run puppeteer tests
with Firefox also.
2021-03-12 12:14:37 -08:00
Anders Kaseorg 3e552268e5 templates: Delete unused markdown_help.html.
Apparently I failed to finish deleting it in commit
7f30e5f9df (#17560).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-11 21:45:48 -08:00
Anders Kaseorg 7f30e5f9df info_overlay: Render Markdown help with frontend Markdown library.
Fixes #15375.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-11 21:24:39 -08:00
Gaurav Pandey 86c883ceb0 tools: Add success message to check-schemas. 2021-03-10 11:54:02 -05:00
Alex Vandiver 3207928418 requirements: Fix paths to 'non-"lock" files'; those are the .in files 2021-03-04 18:08:45 -08:00
Anders Kaseorg d393ac5034 update-prod-static: Remove unused --prev-deploy option.
It’s unused since commit 079ddae4c8
(#12676).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 18:04:57 -08:00
Riken Shah fb8dc7732c puppeteer_test: Set the system default locale to `en_US`.
This commit sets the system default locale to `en_US.UTF-8` before
running the tests.

This was necessary because when running tests with Firefox, it was
failing on some test verifies the results of locale-aware sorting.
2021-03-04 09:40:03 -08:00
Anders Kaseorg d6cdd279d0 documentation_crawler: Fix for Twisted 21.2.0 type hints.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-03 21:46:42 -08:00
Anders Kaseorg b8e5e34c01 install-shfmt: Upgrade shfmt from 3.2.1 to 3.2.2.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-03 21:46:42 -08:00
Anders Kaseorg ccad00b7e9 provision: Suppress exception chaining for CalledProcessError retries.
When exception is raised inside an exception handler, Python 3
helpfully prints both tracebacks separated by “During handling of the
above exception, another exception occurred:”.  But when we’re using
an exception handler to retry the same operation, multiple tracebacks
are just noise.  Suppress the earlier one using PEP 409 syntax.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-03 16:25:03 -08:00
m-e-l-u-h-a-n ec8244b113 tools: Remove -f short option for test-all.
./tools/test-all had a short option -f which was used for running it
by skipping provision check. This short option paired well with its
long version --force, but in an effort to provide more clarity over
the use of force option it is renamed to --skip-provision-check.

Following this rename -f option for test-all does not pair well with
its long part which is now --skip-provision-check. Also, this option
is rarely used. So the short form -f is removed in this commit. We
now provide only its longer version --skip-provision-check.

This is a part of commits done to address issue #17455.
2021-03-03 09:17:49 -08:00
m-e-l-u-h-a-n 63c12d2e59 tools: Change help message for skip-provision-check argument.
This commit changes help message for skip-provision-check argument
used with various test commands. The message is changed with an
intention to be more clear about what this option actually does.

This commit is in series of various changes done to provide clarity
over the use of --force option which is renamed to
--skip-provision-check.

Fixes: #17455
2021-03-03 09:17:49 -08:00
m-e-l-u-h-a-n 911c5f19f1 tools: Rename force argument to skip-provision-check
This commit renames --force argument used with various tests to
--skip-provision-check. As a consequence of this name change all other
files that set --force option for the test commands have been updated.

This change is done in order to provide more clarity for using this
option for runnning tests.

This commit addresses issue #17455.
2021-03-03 09:17:49 -08:00
m-e-l-u-h-a-n ca515e5583 tools: Move registration of --force to test-scripts.py.
This commit moves --force option used with various tests to
test-scripts.py to have it alongside the logic that does provisioning
status assertion.
This is a step towards providing more clarity over use of this
argument with tests as asked in issue #17455.
2021-03-03 09:17:49 -08:00
Anders Kaseorg 79ac5c25b5 zulip_test: Re-export internal functions used by Puppeteer tests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Aman Agrawal 80268c52df ci: Notify in zulip when a build fails in GitHub Actions.
We use the circleci integration which already has a nice setup
for sending messages when triggered to send the build failure
notification.
2021-02-26 08:29:56 -08:00
shanukun 4b67946605 refactor: Make acting_user a mandatory kwarg for do_create_user. 2021-02-25 17:58:00 -08:00
Alex Vandiver 289b5bc100 lint: Re-enable imperative-mood checking.
This was mistakenly disabled in e1f943913a.  Re-enable it.
2021-02-23 14:54:07 -08:00
Alex Vandiver 12ade4c49d lint: Rely on core gitlint skipping of revert commits.
gitlint 0.13.0 and above skip revert commits[1].  This obviates the
need for a custom rule.

[1] https://jorisroovers.com/gitlint/configuration/#ignore-revert-commits
2021-02-23 14:28:09 -08:00
Anders Kaseorg 279c4b0e24 puppeteer_tests: Port to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg 42f4156b36 test-js-with-puppeteer: Error on unhandled promise rejections.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg ca0b01033d lint: Remove custom whitespace rules already enforced by Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-17 22:21:42 -08:00
Wesley Aptekar-Cassels 4173070b3d notifications: Fix composebox notification escaping
The "Narrow to PM with" notification above the composebox was
double-escaped, mangling names with single quotes in them. This removes
the escaping in i18next, causing the name to be escaped only in
handlebars.
2021-02-17 14:04:30 -08:00
Anders Kaseorg 57f2b8760a shared: Format our one Flow file with Prettier.
Why not.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-14 07:03:32 -05:00
Anders Kaseorg f21fbea7c7 lint: Replace (most of) pycodestyle with Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 6e4c3e41dc python: Normalize quotes with Black.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 11741543da python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 5028c081cb python: Merge concatenated string literals that Black would uglify.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 13:11:19 -08:00
Anders Kaseorg 1a4f70f1bc lint: Convert sudo exclusion to double quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-12 08:34:43 -08:00
Anders Kaseorg fc2900c004 js: Convert static/js/settings_config.js to ES6 module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
Anders Kaseorg bbf7bd949b eslint: Enable lines-around-directive.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-10 10:27:14 -08:00
aryanshridhar f92f99d92d dependencies: Replace moment.js with date-fns.
Replaced methods/functions of moment.js with date-fns library.
The motive was to replace it with a smaller frontend timezone library.

Date-fns ~ 11.51 kb
moment.js ~ 217.87 kb

Some of the format strings change because date-fns encodes them
differently from how moment did.

Fixes #16373.
2021-02-05 11:04:32 -08:00
Ganesh Pawar 7eeca9da46 provision: Add provision support for Ubuntu 20.10(Groovy).
PostgreSQL 13 is used when os_version is 20.10.
2021-02-05 09:30:34 -08:00
Anders Kaseorg aa650a4c88 js: Escape strings interpolated into CSS selectors with CSS.escape.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-04 11:00:06 -08:00
Anders Kaseorg 4bcf7131c1 push-to-pull-request: Wait for GitHub background update before merge.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-03 14:55:08 -08:00
aditya-mitra b8f57fa6bb provision: Add provision support for KDE Neon 20.04.
PostgreSQL 12 is used for Neon 20.04, which is a fork of Ubuntu 20.04.
2021-02-03 11:51:05 -08:00
Ganesh Pawar 5802bbfb98 ui_report: Add ui_report.client_error. 2021-01-30 07:48:44 -08:00
Riken Shah baae227efb run-dev: Fix dev url showing extra port.
This commit fixes the issue of `run-dev.py`
showing the development URL with an
extra port when EXTERNAL_HOST
is specified.

Fixes: #17054
2021-01-27 11:37:26 -08:00
Anders Kaseorg 2db2f2d6cd dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Aman Agrawal 599b86241f postcss-simple-vars: Add media query breakpoint variables. 2021-01-25 14:49:32 -08:00
Ganesh Pawar eefa687832 run-dev: Suppress the notices made by third-party tools.
This limits the `run-dev.py` startup output.
And made the terminal message a bit more clear about
accessing the server.

Fixes #16846
2021-01-22 18:00:30 -08:00