diff --git a/.eslintignore b/.eslintignore index 0edb2533ec..f079026d77 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,11 +4,12 @@ /docs/_build /static/generated -/static/third /static/webpack-bundles /var/* !/var/puppeteer /var/puppeteer/* !/var/puppeteer/test_credentials.d.ts +/web/generated +/web/third /zulip-current-venv /zulip-py3-venv diff --git a/.eslintrc.json b/.eslintrc.json index 13bd96a8c9..015961eb0f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -137,7 +137,7 @@ } }, { - "files": ["static/js/**"], + "files": ["web/src/**"], "globals": { "StripeCheckout": false } @@ -217,7 +217,7 @@ } }, { - "files": ["tools/debug-require.js"], + "files": ["web/debug-require.js"], "env": { "browser": true, "es2020": false @@ -231,7 +231,7 @@ } }, { - "files": ["static/**"], + "files": ["web/shared/**", "web/src/**", "web/third/**"], "env": { "browser": true, "node": false @@ -244,7 +244,7 @@ } }, { - "files": ["static/shared/**"], + "files": ["web/shared/**"], "env": { "browser": false, "shared-node-browser": true @@ -255,9 +255,9 @@ { "zones": [ { - "target": "./static/shared", + "target": "./web/shared", "from": ".", - "except": ["./node_modules", "./static/shared"] + "except": ["./node_modules", "./web/shared"] } ] } diff --git a/.github/workflows/production-suite.yml b/.github/workflows/production-suite.yml index 05052b653a..1f78bc39d1 100644 --- a/.github/workflows/production-suite.yml +++ b/.github/workflows/production-suite.yml @@ -14,9 +14,8 @@ on: - puppet/** - requirements/** - scripts/** - - static/assets/** - - static/third/** - tools/** + - web/third/** - webpack.config.ts - yarn.lock - zerver/worker/queue_processors.py diff --git a/.github/workflows/zulip-ci.yml b/.github/workflows/zulip-ci.yml index 478752e549..be1462648d 100644 --- a/.github/workflows/zulip-ci.yml +++ b/.github/workflows/zulip-ci.yml @@ -155,9 +155,9 @@ jobs: # Ban check-database-compatibility.py from transitively # relying on static/generated, because it might not be # up-to-date at that point in upgrade-zulip-stage-2. - chmod 000 static/generated + chmod 000 static/generated web/generated ./scripts/lib/check-database-compatibility.py - chmod 755 static/generated + chmod 755 static/generated web/generated - name: Run documentation and api tests if: ${{ matrix.include_documentation_tests }} diff --git a/.prettierignore b/.prettierignore index 641a993f58..c60c009b07 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,9 +2,9 @@ /corporate/tests/stripe_fixtures /help/**/*.md /locale -/static/third /templates/**/*.md /tools/setup/emoji/emoji_map.json +/web/third /zerver/tests/fixtures /zerver/webhooks/*/doc.md /zerver/webhooks/*/fixtures diff --git a/docs/THIRDPARTY b/docs/THIRDPARTY index 919a016302..b12735c21a 100644 --- a/docs/THIRDPARTY +++ b/docs/THIRDPARTY @@ -51,25 +51,25 @@ Files: static/audio/notification_sounds/zulip.* Copyright: 2011 Vidsyn License: CC0-1.0 -Files: static/third/bootstrap/css/bootstrap-btn.css +Files: web/third/bootstrap/css/bootstrap-btn.css Copyright: 2011-2014 Twitter, Inc License: Expat -Files: static/third/bootstrap/css/bootstrap.css +Files: web/third/bootstrap/css/bootstrap.css Copyright: 2012 Twitter, Inc License: Apache-2.0 Comment: The software has been modified. -Files: static/third/bootstrap/js/bootstrap.js +Files: web/third/bootstrap/js/bootstrap.js Copyright: 2012 Twitter, Inc License: Apache-2.0 -Files: static/third/bootstrap-typeahead/* +Files: web/third/bootstrap-typeahead/* Copyright: 2012 Twitter, Inc License: Apache-2.0 Comment: Bootstrap typeahead. The software has been modified. -Files: static/third/bootstrap-tooltip/* +Files: web/third/bootstrap-tooltip/* Copyright: 2012 Twitter, Inc License: Apache-2.0 Comment: Bootstrap tooltip and bootstrap popover. The software has been modified. @@ -78,16 +78,16 @@ Files: static/generated/emoji/images/emoji/unicode/* Copyright: Google, Inc. License: Apache-2.0 -Files: static/third/jquery-idle/jquery.idle.js +Files: web/third/jquery-idle/jquery.idle.js Copyright: 2011-2013 Henrique Boaventura License: Expat Comment: The software has been modified. -Files: static/third/marked/* +Files: web/third/marked/* Copyright: 2011-2013, Christopher Jeffrey License: Expat -Files: static/shared/icons/ellipsis-v-solid.svg +Files: web/shared/icons/ellipsis-v-solid.svg Copyright: 2017 Fonticons, Inc. License: CC-BY-4.0 Comment: This icon is picked from Version 5.13.0 of Font Awesome @@ -109,7 +109,7 @@ Files: static/audio/notification_sounds/* Copyright: 2021 Stefan Mertens License: CC0-1.0 -Files: static/shared/icons/globe.svg +Files: web/shared/icons/globe.svg Source: https://github.com/ionic-team/ionicons/blob/v5.5.2/src/svg/earth.svg, modified to increase the width of the globe outline. Copyright: 2015-present Ionic (http://ionic.io/) License: Expat @@ -118,7 +118,7 @@ Files: tools/check-thirdparty Copyright: 2020 Kandra Labs, Inc. License: GPL-2.0+ -Files: static/shared/icons/mute.svg +Files: web/shared/icons/mute.svg Source: https://fonts.google.com/icons?selected=Material+Symbols+Rounded:volume_mute Copyright: Google, Inc. License: Apache-2.0 diff --git a/docs/contributing/code-style.md b/docs/contributing/code-style.md index fcb4d36060..a5ebf3c0da 100644 --- a/docs/contributing/code-style.md +++ b/docs/contributing/code-style.md @@ -274,7 +274,7 @@ editor](https://prettier.io/docs/en/editors.html). Combine adjacent on-ready functions, if they are logically related. The best way to build complicated DOM elements is a Handlebars template -like `static/templates/message_reactions.hbs`. For simpler things +like `web/templates/message_reactions.hbs`. For simpler things you can use jQuery DOM building APIs like so: ```js diff --git a/docs/development/using.md b/docs/development/using.md index 53141b25a1..3bdf0412a7 100644 --- a/docs/development/using.md +++ b/docs/development/using.md @@ -75,8 +75,8 @@ the development environment][authentication-dev-server]. - Most changes will take effect automatically. Details: - If you change CSS files, your changes will appear immediately via webpack hot module replacement. - - If you change JavaScript code (`static/js`) or Handlebars - templates (`static/templates`), the browser window will be + - If you change JavaScript code (`web/src`) or Handlebars + templates (`web/templates`), the browser window will be reloaded automatically. - For Jinja2 backend templates (`templates/*`), you'll need to reload the browser window to see your changes. diff --git a/docs/documentation/helpcenter.md b/docs/documentation/helpcenter.md index 74999318bb..1f36d5da76 100644 --- a/docs/documentation/helpcenter.md +++ b/docs/documentation/helpcenter.md @@ -241,7 +241,7 @@ Use non-Mac keyboard keys; for example `Enter`, instead of `Return`. Zulip will automatically translate non-Mac keys to the Mac versions for users with a Mac user agent. If you want to confirm that your documentation is rendering Mac keys correctly when writing documentation in Windows or Linux, you can temporarily -change `has_mac_keyboard` in `/static/js/common.ts` to always return `True`. +change `has_mac_keyboard` in `/web/src/common.ts` to always return `True`. Then when you view your documentation changes in the development environment, the keyboard shortcuts should be rendered with Mac keys where appropriate. diff --git a/docs/git/cheat-sheet.md b/docs/git/cheat-sheet.md index 4489da73c6..253eca702d 100644 --- a/docs/git/cheat-sheet.md +++ b/docs/git/cheat-sheet.md @@ -79,7 +79,7 @@ See also [fixing commits][fix-commit] - `git fetch origin`: fetch origin repository - `git fetch upstream`: fetch upstream repository - grep - - `git grep update_unread_counts static/js`: Search our JS for references to update_unread_counts. + - `git grep update_unread_counts web/src`: Search our JS for references to update_unread_counts. - log - `git log`: show commit logs - `git log --oneline | head`: To quickly see the latest ten commits on a branch. diff --git a/docs/overview/directory-structure.md b/docs/overview/directory-structure.md index 04ceb7274e..a902196f54 100644 --- a/docs/overview/directory-structure.md +++ b/docs/overview/directory-structure.md @@ -50,23 +50,25 @@ templating systems. - `templates/zerver/` For [Jinja2](http://jinja.pocoo.org/) templates for the backend (for zerver app; logged-in content is in `templates/zerver/app`). -- `static/templates/` [Handlebars](https://handlebarsjs.com/) templates for the frontend. +- `web/templates/` [Handlebars](https://handlebarsjs.com/) templates for the frontend. --- -### JavaScript, TypeScript, and other static assets +### JavaScript, TypeScript, and other frontend assets -- `static/js/` Zulip's own JavaScript and TypeScript sources. +- `web/src/` Zulip's own JavaScript and TypeScript sources. -- `static/styles/` Zulip's own CSS. +- `web/styles/` Zulip's own CSS. -- `static/images/` Zulip's images. +- `web/images/` Images bundled with webpack. -- `static/third/` Third-party JavaScript and CSS that has been vendored. +- `static/images/` Images served directly to the web. + +- `web/third/` Third-party JavaScript and CSS that has been vendored. - `node_modules/` Third-party JavaScript installed via `yarn`. -- `static/shared/icons/` Icons placed in this directory are compiled +- `web/shared/icons/` Icons placed in this directory are compiled into an icon font. --- diff --git a/docs/subsystems/analytics.md b/docs/subsystems/analytics.md index fa38bbfae5..873320701b 100644 --- a/docs/subsystems/analytics.md +++ b/docs/subsystems/analytics.md @@ -182,9 +182,9 @@ The relevant files are: get_chart_data in this file. The bottom half of this file (with all the raw sql queries) is for a different page (/activity), not related to /stats. -- static/js/stats/stats.js: The JavaScript and Plotly code. +- web/src/stats/stats.js: The JavaScript and Plotly code. - templates/analytics/stats.html -- static/styles/stats.css and static/styles/portico.css: We are in the +- web/styles/stats.css and web/styles/portico.css: We are in the process of re-styling this page to use in-app css instead of portico css, but there is currently still a lot of portico influence. - analytics/urls.py: Has the URL routes; it's unlikely you will have to diff --git a/docs/subsystems/dependencies.md b/docs/subsystems/dependencies.md index 8e63cc51b0..fd28de5e4d 100644 --- a/docs/subsystems/dependencies.md +++ b/docs/subsystems/dependencies.md @@ -242,7 +242,7 @@ reasoning here. release tarball. - **Checked-in packages**. In contrast with Python, we have a few JavaScript dependencies that we have copied into the main Zulip - repository under `static/third`, often with patches. These date + repository under `web/third`, often with patches. These date from an era before `npm` existed. It is a project goal to eliminate these checked-in versions of dependencies and instead use versions managed by the npm repositories. @@ -317,7 +317,7 @@ implementation of that tool. The list of languages supported by our Markdown syntax highlighting comes from the [pygments][] package. `tools/setup/build_pygments_data` is -responsible for generating `static/generated/pygments_data.json` so that +responsible for generating `web/generated/pygments_data.json` so that our JavaScript Markdown processor has access to the supported list. ## Modifying provisioning diff --git a/docs/subsystems/hashchange-system.md b/docs/subsystems/hashchange-system.md index d72e15854a..fd060f1e8c 100644 --- a/docs/subsystems/hashchange-system.md +++ b/docs/subsystems/hashchange-system.md @@ -17,7 +17,7 @@ Some examples are: stream.) The main module in the frontend that manages this all is -`static/js/hashchange.js` (plus `hash_util.js` for all the parsing +`web/src/hashchange.js` (plus `hash_util.js` for all the parsing code), which is unfortunately one of our thorniest modules. Part of the reason that it's thorny is that it needs to support a lot of different flows: @@ -54,7 +54,7 @@ all of this (would be a good project to add them to the [Puppeteer suite][testing-with-puppeteer]) and there's enough complexity that it's easy to accidentally break something. -The main external API lives in `static/js/browser_history.js`: +The main external API lives in `web/src/browser_history.js`: - `browser_history.update` is used to update the browser history, and it should be called when the app code is taking care @@ -97,7 +97,7 @@ reload itself: start looking for a good time to reload, based on when the user is idle (ideally, we'd reload when they're not looking and restore state so that the user never knew it happened!). The logic for - doing this is in `static/js/reload.js`; but regardless we'll reload + doing this is in `web/src/reload.js`; but regardless we'll reload within 30 minutes unconditionally. An important detail in server-initiated reloads is that we diff --git a/docs/subsystems/hotspots.md b/docs/subsystems/hotspots.md index c19b97bdd0..f8a8383fca 100644 --- a/docs/subsystems/hotspots.md +++ b/docs/subsystems/hotspots.md @@ -30,7 +30,7 @@ ALL_HOTSPOTS = { ### Step 2: Configure hotspot placement The target element and visual orientation of each hotspot is specified in -`HOTSPOT_LOCATIONS` of `static/js/hotspots.js`. +`HOTSPOT_LOCATIONS` of `web/src/hotspots.js`. The `icon_offset` property specifies where the pulsing icon is placed _relative to the width and height of the target element_. @@ -67,7 +67,7 @@ content and behind sidebars and overlays. If a hotspot is associated with a target element on a sidebar or overlay, the icon's z-index may need to be increased to 101, 102, or 103. -This adjustment can be made at the bottom of `static/styles/hotspots.css`: +This adjustment can be made at the bottom of `web/styles/hotspots.css`: ```css #hotspot_new_hotspot_name_icon { diff --git a/docs/subsystems/html-css.md b/docs/subsystems/html-css.md index 295aac3791..73eb1ef99d 100644 --- a/docs/subsystems/html-css.md +++ b/docs/subsystems/html-css.md @@ -2,13 +2,13 @@ ## Zulip CSS organization -The Zulip application's CSS can be found in the `static/styles/` +The Zulip application's CSS can be found in the `web/styles/` directory. Zulip uses [Bootstrap](https://getbootstrap.com/) as its main third-party CSS library. Zulip uses PostCSS for its CSS files. There are two high-level sections of CSS: the "portico" (logged-out pages like /help/, /login/, etc.), -and the app. The portico CSS lives under the `static/styles/portico` +and the app. The portico CSS lives under the `web/styles/portico` subdirectory. ## Editing Zulip CSS @@ -111,7 +111,7 @@ path('config-error/google', TemplateView.as_view( For text generated in the frontend, live-rendering HTML from JavaScript for things like the main message feed, we use the -[Handlebars][] template engine (files in `static/templates/`) and +[Handlebars][] template engine (files in `web/templates/`) and sometimes work directly from JavaScript code (though as a policy matter, we try to avoid generating HTML directly in JavaScript wherever possible). @@ -150,13 +150,13 @@ relevant background as well. ### Primary build process -Zulip's frontend is primarily JavaScript in the `static/js` directory; +Zulip's frontend is primarily JavaScript in the `web/src` directory; we are working on migrating these to TypeScript modules. Stylesheets are written in CSS extended by various PostCSS plugins; they are converted from plain CSS, and we have yet to take full advantage of the features PostCSS offers. We use Webpack to transpile and build JS and CSS bundles that the browser can understand, one for each entry -points specified in `tools/webpack.*assets.json`; source maps are +points specified in `web/webpack.*assets.json`; source maps are generated in the process for better debugging experience. In development mode, bundles are built and served on the fly using @@ -169,7 +169,7 @@ ready for deployment. You can trace which source files are included in which HTML templates by comparing the `entrypoint` variables in the HTML templates under -`templates/` with the bundles declared in `tools/webpack.*assets.json`. +`templates/` with the bundles declared in `web/webpack.*assets.json`. ### Adding static files @@ -187,34 +187,34 @@ first add it to the appropriate place under `static/`. We update those versions periodically to ensure we're running a recent version of third-party libraries. - Third-party files that we have patched should all go in - `static/third/`. Tag the commit with "[third]" when adding or + `web/third/`. Tag the commit with "[third]" when adding or modifying a third-party package. Our goal is to the extent possible to eliminate patched third-party code from the project. -- Our own JavaScript and TypeScript files live under `static/js`. Ideally, +- Our own JavaScript and TypeScript files live under `web/src`. Ideally, new modules should be written in TypeScript (details on this policy below). -- CSS files live under `static/styles`. +- CSS files live under `web/styles`. - Portico JavaScript ("portico" means for logged-out pages) lives under - `static/js/portico`. -- Custom SVG graphics living under `static/assets/icons` are compiled into + `web/src/portico`. +- Custom SVG graphics living under `web/images/icons` are compiled into custom icon webfonts by webfont-loader according to the - `static/assets/icons/template.hbs` template. + `web/images/icons/template.hbs` template. For your asset to be included in a development/production bundle, it needs to be accessible from one of the entry points defined either in -`tools/webpack.assets.json` or `tools/webpack.dev-assets.json`. +`web/webpack.assets.json` or `web/webpack.dev-assets.json`. - If you plan to only use the file within the app proper, and not on the login page or other standalone pages, put it in the `app` bundle by importing it - in `static/js/bundles/app.js`. + in `web/src/bundles/app.js`. - If it needs to be available both in the app and all logged-out/portico pages, import it to - `static/js/bundles/common.js` which itself is imported to the + `web/src/bundles/common.js` which itself is imported to the `app` and `common` bundles. - If it's just used on a single standalone page which is only used in a development environment (e.g. `/devlogin`) create a new entry - point in `tools/webpack.dev-assets.json` or it's used in both + point in `web/webpack.dev-assets.json` or it's used in both production and development (e.g. `/stats`) create a new entry point - in `tools/webpack.assets.json`. Use the `bundle` macro (defined in + in `web/webpack.assets.json`. Use the `bundle` macro (defined in `templates/zerver/base.html`) in the relevant Jinja2 template to inject the compiled JS and CSS. @@ -267,11 +267,11 @@ TypeScript also uses the ES6 module system. See our documentation on Webpack does not ordinarily allow modules to be accessed directly from the browser console, but for debugging convenience, we have a custom -webpack plugin (`tools/debug-require-webpack-plugin.ts`) that exposes +webpack plugin (`web/debug-require-webpack-plugin.ts`) that exposes a version of the `require()` function to the development environment browser console for this purpose. For example, you can access our `people` module by evaluating -`people = require("./static/js/people")`, or the third-party `lodash` +`people = require("./web/src/people")`, or the third-party `lodash` module with `_ = require("lodash")`. This mechanism is **not** a stable API and should not be used for any purpose other than interactive debugging. diff --git a/docs/subsystems/input-pills.md b/docs/subsystems/input-pills.md index 47448e21bc..60b3961241 100644 --- a/docs/subsystems/input-pills.md +++ b/docs/subsystems/input-pills.md @@ -26,7 +26,7 @@ var pills = input_pill.create({ }); ``` -You can look at `static/js/user_pill.js` to see how the above +You can look at `web/src/user_pill.js` to see how the above methods are implemented. Essentially you just need to convert from raw data (like an email) to structured data (like an object with display_value, email, and user_id for a user), and vice diff --git a/docs/subsystems/logging.md b/docs/subsystems/logging.md index cb34d88f39..02cf459df6 100644 --- a/docs/subsystems/logging.md +++ b/docs/subsystems/logging.md @@ -191,7 +191,7 @@ might use). In development, this means displaying a highly visible overlay over the message view area, to make exceptions in testing a new feature hard to miss. -- Blueslip is implemented in `static/js/blueslip.js`. +- Blueslip is implemented in `web/src/blueslip.js`. - In order to capture essentially any error occurring in the browser, Blueslip listens for the `error` event on `window`, and has methods for being manually triggered by Zulip JavaScript code for warnings @@ -200,7 +200,7 @@ new feature hard to miss. browser session, and includes them in reports to the server, so that one can see cases where exceptions chained together. You can print this log from the browser console using - `blueslip = require("./static/js/blueslip"); blueslip.get_log()`. + `blueslip = require("./web/src/blueslip"); blueslip.get_log()`. Blueslip supports several error levels: @@ -236,7 +236,7 @@ and report to the server the following whenever a message is sent: the server-rendered content, which can be used for statistics on how effective our [local echo system](markdown.md) is. -The code is all in `zerver/lib/report.py` and `static/js/sent_messages.js`. +The code is all in `zerver/lib/report.py` and `web/src/sent_messages.js`. We have similar reporting for the time it takes to narrow / switch to a new view: diff --git a/docs/subsystems/markdown.md b/docs/subsystems/markdown.md index b56ce893f7..2b69522d96 100644 --- a/docs/subsystems/markdown.md +++ b/docs/subsystems/markdown.md @@ -17,7 +17,7 @@ authoritatively render messages to HTML (and implements slow/expensive/complex features like querying the Twitter API to render tweets nicely). The frontend implementation is in JavaScript, based on [marked.js](https://github.com/chjj/marked) -(`static/js/echo.js`), and is used to preview and locally echo +(`web/src/echo.js`), and is used to preview and locally echo messages the moment the sender hits Enter, without waiting for round trip from the server. Those frontend renderings are only shown to the sender of a message, and they are (ideally) identical to the backend @@ -101,12 +101,12 @@ When changing Zulip's Markdown syntax, you need to update several places: - The backend Markdown processor (`zerver/lib/markdown/__init__.py`). -- The frontend Markdown processor (`static/js/markdown.js` and sometimes - `static/third/marked/lib/marked.js`), or `markdown.contains_backend_only_syntax` if +- The frontend Markdown processor (`web/src/markdown.js` and sometimes + `web/third/marked/lib/marked.js`), or `markdown.contains_backend_only_syntax` if your changes won't be supported in the frontend processor. -- If desired, the typeahead logic in `static/js/composebox_typeahead.js`. +- If desired, the typeahead logic in `web/src/composebox_typeahead.js`. - The test suite, probably via adding entries to `zerver/tests/fixtures/markdown_test_cases.json`. -- The in-app Markdown documentation (`markdown_help_rows` in `static/js/info_overlay.js`). +- The in-app Markdown documentation (`markdown_help_rows` in `web/src/info_overlay.js`). - The list of changes to Markdown at the end of this document. Important considerations for any changes are: diff --git a/docs/subsystems/notifications.md b/docs/subsystems/notifications.md index fcdc1d63ce..0c154aa02b 100644 --- a/docs/subsystems/notifications.md +++ b/docs/subsystems/notifications.md @@ -97,7 +97,7 @@ as follows: debugging this system, since it has so much complexity. - Desktop notifications are the simplest; they are implemented client-side by the web/desktop app's logic - (`static/js/notifications.js`) inspecting the `flags` fields that + (`web/src/notifications.js`) inspecting the `flags` fields that were spliced into `message` events by the Tornado system, as well as the user's notification settings. - The queue processors for those queues make the final determination diff --git a/docs/subsystems/presence.md b/docs/subsystems/presence.md index 5b26affd39..29a0161ed5 100644 --- a/docs/subsystems/presence.md +++ b/docs/subsystems/presence.md @@ -47,7 +47,7 @@ about that data structure: - Users can disable their own presence updates in user settings (`UserProfile.presence_enabled` is the flag storing [this user preference](https://zulip.com/help/status-and-availability#disable-updating-availability)). -- The `status_from_timestamp` function in `static/js/presence.js` is +- The `status_from_timestamp` function in `web/src/presence.js` is useful sample code; the `OFFLINE_THRESHOLD_SECS` check is critical to correct output. - We provide the data for e.g. whether the user was online on their diff --git a/docs/subsystems/sending-messages.md b/docs/subsystems/sending-messages.md index 94aa8107f8..1b35223f67 100644 --- a/docs/subsystems/sending-messages.md +++ b/docs/subsystems/sending-messages.md @@ -162,7 +162,7 @@ messages. properties (at the very least, message ID and timestamp) and rerenders it in any message lists where it appears. This is primarily done in the `process_from_server` function in - `static/js/echo.js`. + `web/src/echo.js`. ### Local echo in message editing diff --git a/docs/subsystems/slash-commands.md b/docs/subsystems/slash-commands.md index 4ce79d4de9..affda95dae 100644 --- a/docs/subsystems/slash-commands.md +++ b/docs/subsystems/slash-commands.md @@ -52,4 +52,4 @@ send a message with the raw content. ## Typeahead Typeahead for both slash commands (and widgets) is implemented -via the `slash_commands` object in `static/js/composebox_typeahead.js`. +via the `slash_commands` object in `web/src/composebox_typeahead.js`. diff --git a/docs/subsystems/typing-indicators.md b/docs/subsystems/typing-indicators.md index ef14635dec..c4b3ab89d7 100644 --- a/docs/subsystems/typing-indicators.md +++ b/docs/subsystems/typing-indicators.md @@ -45,7 +45,7 @@ repeated updates to the server, so that downstream clients know that the user is still typing. (Zulip messages tend to be longer than messages in other chat/text clients, so this detail is important.) -We have a small state machine in `static/shared/js/typing_status.js` that +We have a small state machine in `web/shared/src/typing_status.js` that makes sure subsequent "start" requests get sent out every ten seconds. (This document is intended to describe the high level architecture; the actual time values may be tuned in future releases. @@ -107,15 +107,15 @@ structures, and then it eventually shows or hides status messages. We'll describe the flow of data through the web app as a concrete example. -The events will come in to `static/js/server_events_dispatch.js`. +The events will come in to `web/src/server_events_dispatch.js`. The `stop` and `start` operations get further handled by -`static/js/typing_events.js`. +`web/src/typing_events.js`. The main goal is then to triage which events should lead to display changes. The web app client maintains a list of incoming "typists" using -code in `static/js/typing_data.js`. The API here has functions +code in `web/src/typing_data.js`. The API here has functions like the following: - `add_typist` diff --git a/docs/subsystems/widgets.md b/docs/subsystems/widgets.md index 70e5f18290..62dd87c959 100644 --- a/docs/subsystems/widgets.md +++ b/docs/subsystems/widgets.md @@ -51,11 +51,11 @@ Some important code entities for the widget implementation are: - `SubMessage` database table - `/json/submessage` API endpoint -- `static/js/submessage.js` -- `static/js/poll_widget.js` -- `static/js/widgetize.js` -- `static/js/zform.js` -- `static/templates/widgets/` +- `web/src/submessage.js` +- `web/src/poll_widget.js` +- `web/src/widgetize.js` +- `web/src/zform.js` +- `web/templates/widgets/` - `zerver/lib/widget.py` - `zerver/views/submessage.py` @@ -105,10 +105,10 @@ is given a parent `elem` when its `activate` function is called. This is just a `
` inside of the parent message in the message pane. The widget has access to jQuery and template.render, and the developer can create -new templates in `static/templates/widgets/`. +new templates in `web/templates/widgets/`. A good way to learn the system is to read the code -in `static/js/poll_widget.js`. It is worth noting that +in `web/src/poll_widget.js`. It is worth noting that writing a new widget requires only minor backend changes in the current architecture. This could change in the future, but for now, a frontend developer mostly @@ -299,7 +299,7 @@ When the message gets to the client, the codepath for **zform** is actually quite similar to what happens with a more customized widget like **poll**. (In fact, **zform** is a sibling of **poll** and **zform** just has a somewhat more -generic job to do.) In `static/js/widgetize.js` you will see +generic job to do.) In `web/src/widgetize.js` you will see where this code converges, with snippets like this: ```js @@ -308,7 +308,7 @@ widgets.todo = todo_widget; widgets.zform = zform; ``` -The code in `static/js/zform.js` renders the form (not +The code in `web/src/zform.js` renders the form (not shown here) and then sets up a click handler like below: ```js diff --git a/docs/testing/linters.md b/docs/testing/linters.md index e449d1259e..fc6c392040 100644 --- a/docs/testing/linters.md +++ b/docs/testing/linters.md @@ -45,8 +45,8 @@ You can also run them individually or pass specific files: ```bash ./tools/lint -./tools/lint static/js/compose.js -./tools/lint static/js/ +./tools/lint web/src/compose.js +./tools/lint web/src/ ``` `./tools/lint` has many useful options; you can read about them in its diff --git a/docs/testing/testing-with-node.md b/docs/testing/testing-with-node.md index 57d06a1ecc..558733c345 100644 --- a/docs/testing/testing-with-node.md +++ b/docs/testing/testing-with-node.md @@ -39,7 +39,7 @@ in `frontend_tests/node_tests`. Here is an example test from ``` The names of the node tests generally align with the names of the -modules they test. If you modify a JS module in `static/js` you should +modules they test. If you modify a JS module in `web/src` you should see if there are corresponding test in `frontend_tests/node_tests`. If there are, you should strive to follow the patterns of the existing tests and add your own tests. @@ -120,7 +120,7 @@ For modules that you want to completely stub out, use a pattern like this: ```js -const reminder = mock_esm("../../static/js/reminder", { +const reminder = mock_esm("../../web/src/reminder", { is_deferred_delivery: noop, }); diff --git a/docs/translating/internationalization.md b/docs/translating/internationalization.md index 2d12023ec8..426ebf615a 100644 --- a/docs/translating/internationalization.md +++ b/docs/translating/internationalization.md @@ -239,7 +239,7 @@ $("#foo").html( The only HTML tags allowed directly in translated strings are the simple HTML tags enumerated in `default_html_elements` -(`static/js/i18n.js`) with no attributes. This helps to avoid +(`web/src/i18n.js`) with no attributes. This helps to avoid exposing HTML details to translators. If you need to include more complex markup such as a link, you can define a custom HTML tag locally to the translation: diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.md index d52379ece4..27bb15db43 100644 --- a/docs/tutorials/new-feature-tutorial.md +++ b/docs/tutorials/new-feature-tutorial.md @@ -44,11 +44,11 @@ organization in Zulip). The following files are involved in the process: **Frontend** -- `static/templates/settings/organization_permissions_admin.hbs`: defines +- `web/templates/settings/organization_permissions_admin.hbs`: defines the structure of the admin permissions page (checkboxes for each organization permission setting). -- `static/js/settings_org.js`: handles organization setting form submission. -- `static/js/server_events_dispatch.js`: handles events coming from the server +- `web/src/settings_org.js`: handles organization setting form submission. +- `web/src/server_events_dispatch.js`: handles events coming from the server (ex: pushing an organization change to other open browsers and updating the application's state). @@ -124,17 +124,17 @@ Realm setting, in `test_realm.py`). ### Frontend changes **JavaScript/TypeScript:** Zulip's JavaScript and TypeScript sources are -located in the directory `static/js/`. The exact files you may need to change +located in the directory `web/src/`. The exact files you may need to change depend on your feature. If you've added a new event that is sent to clients, -be sure to add a handler for it in `static/js/server_events_dispatch.js`. +be sure to add a handler for it in `web/src/server_events_dispatch.js`. -**CSS:** The primary CSS file is `static/styles/zulip.css`. If your new +**CSS:** The primary CSS file is `web/styles/zulip.css`. If your new feature requires UI changes, you may need to add additional CSS to this file. **Templates:** The initial page structure is rendered via Jinja2 templates located in `templates/zerver/app`. For JavaScript, Zulip uses -Handlebars templates located in `static/templates`. Templates are +Handlebars templates located in `web/templates`. Templates are precompiled as part of the build/deploy process. Zulip is fully internationalized, so when writing both HTML templates @@ -532,7 +532,7 @@ to server when a realm is updated) and the change event needs to be handled on the client. To add the checkbox to the admin page, modify the relevant template in -`static/templates/settings/`, which can be +`web/templates/settings/`, which can be `organization_permissions_admin.hbs` or `organization_settings_admin.hbs` (omitted here since it is relatively straightforward). @@ -540,10 +540,10 @@ If you're adding a non-checkbox field, you'll need to specify the type of the field via the `data-setting-widget-type` attribute in the HTML template. -Then add the new form control in `static/js/admin.js`. +Then add the new form control in `web/src/admin.js`. ```diff - // static/js/admin.js + // web/src/admin.js export function build_page() { const options = { @@ -556,7 +556,7 @@ Then add the new form control in `static/js/admin.js`. ``` The JavaScript code for organization settings and permissions can be found in -`static/js/settings_org.js`. +`web/src/settings_org.js`. In frontend, we have split the `property_types` into three objects: @@ -616,7 +616,7 @@ setting has changed, your function should be referenced in the `settings_emoji.update_custom_emoji_ui`. ```diff - // static/js/server_events_dispatch.js + // web/src/server_events_dispatch.js function dispatch_normal_event(event) { switch (event.type) { diff --git a/docs/tutorials/writing-views.md b/docs/tutorials/writing-views.md index 0e088640db..05cd1d926d 100644 --- a/docs/tutorials/writing-views.md +++ b/docs/tutorials/writing-views.md @@ -282,7 +282,7 @@ Zulip realm). You should always use `channel.` to make an `HTTP ` call to the Zulip JSON API. As an example, in -[static/js/admin.js](https://github.com/zulip/zulip/blob/main/static/js/admin.js) +[web/src/admin.js](https://github.com/zulip/zulip/blob/main/web/src/admin.js) ```js var url = "/json/realm"; diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index 853757d70c..984e8c80a0 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -18,15 +18,15 @@ const _document = { }, }; -const channel = mock_esm("../../static/js/channel"); -const compose_state = mock_esm("../../static/js/compose_state"); -const narrow = mock_esm("../../static/js/narrow"); -const padded_widget = mock_esm("../../static/js/padded_widget"); -const pm_list = mock_esm("../../static/js/pm_list"); -const popovers = mock_esm("../../static/js/popovers"); -const resize = mock_esm("../../static/js/resize"); -const scroll_util = mock_esm("../../static/js/scroll_util"); -const watchdog = mock_esm("../../static/js/watchdog"); +const channel = mock_esm("../../web/src/channel"); +const compose_state = mock_esm("../../web/src/compose_state"); +const narrow = mock_esm("../../web/src/narrow"); +const padded_widget = mock_esm("../../web/src/padded_widget"); +const pm_list = mock_esm("../../web/src/pm_list"); +const popovers = mock_esm("../../web/src/popovers"); +const resize = mock_esm("../../web/src/resize"); +const scroll_util = mock_esm("../../web/src/scroll_util"); +const watchdog = mock_esm("../../web/src/watchdog"); set_global("document", _document); diff --git a/frontend_tests/node_tests/alert_words_ui.js b/frontend_tests/node_tests/alert_words_ui.js index a1a797133e..d61a163d55 100644 --- a/frontend_tests/node_tests/alert_words_ui.js +++ b/frontend_tests/node_tests/alert_words_ui.js @@ -7,7 +7,7 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const channel = mock_esm("../../static/js/channel"); +const channel = mock_esm("../../web/src/channel"); const alert_words = zrequire("alert_words"); const alert_words_ui = zrequire("alert_words_ui"); @@ -20,7 +20,7 @@ const noop = () => {}; run_test("rerender_alert_words_ui", ({mock_template}) => { let list_widget_create_called = false; alert_words_ui.reset(); - const ListWidget = mock_esm("../../static/js/list_widget", { + const ListWidget = mock_esm("../../web/src/list_widget", { modifier: noop, create(container, words, opts) { const alert_words = []; diff --git a/frontend_tests/node_tests/billing.js b/frontend_tests/node_tests/billing.js index eb6b09ebe0..db3fd96046 100644 --- a/frontend_tests/node_tests/billing.js +++ b/frontend_tests/node_tests/billing.js @@ -14,7 +14,7 @@ const dom = new JSDOM(template, {pretendToBeVisual: true}); const document = dom.window.document; const location = set_global("location", {}); -const helpers = mock_esm("../../static/js/billing/helpers", { +const helpers = mock_esm("../../web/src/billing/helpers", { set_tab() {}, }); diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.js index d9b0b8e3b5..8ab378e4ea 100644 --- a/frontend_tests/node_tests/billing_helpers.js +++ b/frontend_tests/node_tests/billing_helpers.js @@ -19,7 +19,7 @@ const dom = new JSDOM(template, { const jquery = jQueryFactory(dom.window); const history = set_global("history", {}); -const loading = mock_esm("../../static/js/loading"); +const loading = mock_esm("../../web/src/loading"); set_global("document", { title: "Zulip", }); diff --git a/frontend_tests/node_tests/blueslip_stacktrace.js b/frontend_tests/node_tests/blueslip_stacktrace.js index 3b5ff72bb5..3192929728 100644 --- a/frontend_tests/node_tests/blueslip_stacktrace.js +++ b/frontend_tests/node_tests/blueslip_stacktrace.js @@ -10,8 +10,8 @@ const blueslip_stacktrace = zrequire("blueslip_stacktrace"); run_test("clean_path", () => { // Local file assert.strictEqual( - blueslip_stacktrace.clean_path("webpack:///static/js/upload.js"), - "/static/js/upload.js", + blueslip_stacktrace.clean_path("webpack:///web/src/upload.js"), + "/web/src/upload.js", ); // Third party library (jQuery) @@ -36,9 +36,9 @@ run_test("clean_function_name", () => { // Local file assert.deepEqual( - blueslip_stacktrace.clean_function_name("Object../static/js/upload.js.exports.options"), + blueslip_stacktrace.clean_function_name("Object../web/src/upload.js.exports.options"), { - scope: "Object../static/js/upload.js.exports.", + scope: "Object../web/src/upload.js.exports.", name: "options", }, ); diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js index 0c1e327f9e..95d886f11d 100644 --- a/frontend_tests/node_tests/buddy_data.js +++ b/frontend_tests/node_tests/buddy_data.js @@ -9,7 +9,7 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const {page_params, user_settings} = require("../zjsunit/zpage_params"); -const timerender = mock_esm("../../static/js/timerender"); +const timerender = mock_esm("../../web/src/timerender"); const compose_fade_helper = zrequire("compose_fade_helper"); const muted_users = zrequire("muted_users"); diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js index 903a4e3c26..316d91301b 100644 --- a/frontend_tests/node_tests/buddy_list.js +++ b/frontend_tests/node_tests/buddy_list.js @@ -9,8 +9,8 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const $ = require("../zjsunit/zjquery"); -const padded_widget = mock_esm("../../static/js/padded_widget"); -const message_viewport = mock_esm("../../static/js/message_viewport"); +const padded_widget = mock_esm("../../web/src/padded_widget"); +const message_viewport = mock_esm("../../web/src/message_viewport"); const people = zrequire("people"); const {BuddyList} = zrequire("buddy_list"); diff --git a/frontend_tests/node_tests/channel.js b/frontend_tests/node_tests/channel.js index a450f3f9dc..c39317aac1 100644 --- a/frontend_tests/node_tests/channel.js +++ b/frontend_tests/node_tests/channel.js @@ -13,7 +13,7 @@ const xhr_401 = { }; let login_to_access_shown = false; -mock_esm("../../static/js/spectators", { +mock_esm("../../web/src/spectators", { login_to_access() { login_to_access_shown = true; }, diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index dd8b6267f4..f33a7c6bcf 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -28,19 +28,19 @@ set_global( const fake_now = 555; -const channel = mock_esm("../../static/js/channel"); -const compose_actions = mock_esm("../../static/js/compose_actions"); -const compose_fade = mock_esm("../../static/js/compose_fade"); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); -const loading = mock_esm("../../static/js/loading"); -const markdown = mock_esm("../../static/js/markdown"); -const reminder = mock_esm("../../static/js/reminder"); -const rendered_markdown = mock_esm("../../static/js/rendered_markdown"); -const resize = mock_esm("../../static/js/resize"); -const sent_messages = mock_esm("../../static/js/sent_messages"); -const server_events = mock_esm("../../static/js/server_events"); -const transmit = mock_esm("../../static/js/transmit"); -const upload = mock_esm("../../static/js/upload"); +const channel = mock_esm("../../web/src/channel"); +const compose_actions = mock_esm("../../web/src/compose_actions"); +const compose_fade = mock_esm("../../web/src/compose_fade"); +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); +const loading = mock_esm("../../web/src/loading"); +const markdown = mock_esm("../../web/src/markdown"); +const reminder = mock_esm("../../web/src/reminder"); +const rendered_markdown = mock_esm("../../web/src/rendered_markdown"); +const resize = mock_esm("../../web/src/resize"); +const sent_messages = mock_esm("../../web/src/sent_messages"); +const server_events = mock_esm("../../web/src/server_events"); +const transmit = mock_esm("../../web/src/transmit"); +const upload = mock_esm("../../web/src/upload"); const compose_ui = zrequire("compose_ui"); const compose_banner = zrequire("compose_banner"); diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index c9df858397..132e1a8b08 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -17,38 +17,38 @@ set_global("document", { to_$: () => $("document-stub"), }); -const channel = mock_esm("../../static/js/channel"); -const compose_fade = mock_esm("../../static/js/compose_fade", { +const channel = mock_esm("../../web/src/channel"); +const compose_fade = mock_esm("../../web/src/compose_fade", { clear_compose: noop, }); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); -const compose_ui = mock_esm("../../static/js/compose_ui", { +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); +const compose_ui = mock_esm("../../web/src/compose_ui", { autosize_textarea: noop, is_full_size: () => false, }); -const hash_util = mock_esm("../../static/js/hash_util"); -const narrow_state = mock_esm("../../static/js/narrow_state", { +const hash_util = mock_esm("../../web/src/hash_util"); +const narrow_state = mock_esm("../../web/src/narrow_state", { set_compose_defaults: noop, }); -mock_esm("../../static/js/reload_state", { +mock_esm("../../web/src/reload_state", { is_in_progress: () => false, }); -mock_esm("../../static/js/recent_topics_util", { +mock_esm("../../web/src/recent_topics_util", { is_visible: noop, }); -mock_esm("../../static/js/drafts", { +mock_esm("../../web/src/drafts", { update_draft: noop, }); -mock_esm("../../static/js/unread_ops", { +mock_esm("../../web/src/unread_ops", { notify_server_message_read: noop, }); -mock_esm("../../static/js/message_lists", { +mock_esm("../../web/src/message_lists", { current: { can_mark_messages_read: () => true, }, }); -mock_esm("../../static/js/resize", { +mock_esm("../../web/src/resize", { reset_compose_message_max_height: noop, }); diff --git a/frontend_tests/node_tests/compose_closed_ui.js b/frontend_tests/node_tests/compose_closed_ui.js index f373b2f027..c5d1107e36 100644 --- a/frontend_tests/node_tests/compose_closed_ui.js +++ b/frontend_tests/node_tests/compose_closed_ui.js @@ -7,13 +7,13 @@ const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -mock_esm("../../static/js/recent_topics_util", { +mock_esm("../../web/src/recent_topics_util", { is_visible: () => false, }); const noop = () => {}; // Mocking and stubbing things set_global("document", "document-stub"); -const message_lists = mock_esm("../../static/js/message_lists"); +const message_lists = mock_esm("../../web/src/message_lists"); function MessageListView() { return { maybe_rerender: noop, @@ -21,7 +21,7 @@ function MessageListView() { prepend: noop, }; } -mock_esm("../../static/js/message_list_view", { +mock_esm("../../web/src/message_list_view", { MessageListView, }); // Code we're actually using/testing diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.js index 7758d35180..0b77e85ccc 100644 --- a/frontend_tests/node_tests/compose_pm_pill.js +++ b/frontend_tests/node_tests/compose_pm_pill.js @@ -6,8 +6,8 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const compose_actions = mock_esm("../../static/js/compose_actions"); -const input_pill = mock_esm("../../static/js/input_pill"); +const compose_actions = mock_esm("../../web/src/compose_actions"); +const input_pill = mock_esm("../../web/src/input_pill"); const people = zrequire("people"); const compose_pm_pill = zrequire("compose_pm_pill"); diff --git a/frontend_tests/node_tests/compose_state.js b/frontend_tests/node_tests/compose_state.js index 2ed0ed280a..f84c881911 100644 --- a/frontend_tests/node_tests/compose_state.js +++ b/frontend_tests/node_tests/compose_state.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); const compose_state = zrequire("compose_state"); diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.js index 896ff74413..502f8b2d0e 100644 --- a/frontend_tests/node_tests/compose_ui.js +++ b/frontend_tests/node_tests/compose_ui.js @@ -13,15 +13,15 @@ const noop = () => {}; set_global("navigator", {}); -mock_esm("../../static/js/message_lists", { +mock_esm("../../web/src/message_lists", { current: {}, }); const compose_ui = zrequire("compose_ui"); const people = zrequire("people"); const user_status = zrequire("user_status"); -const hash_util = mock_esm("../../static/js/hash_util"); -const channel = mock_esm("../../static/js/channel"); +const hash_util = mock_esm("../../web/src/hash_util"); +const channel = mock_esm("../../web/src/channel"); const compose_actions = zrequire("compose_actions"); const message_lists = zrequire("message_lists"); const text_field_edit = mock_esm("text-field-edit"); diff --git a/frontend_tests/node_tests/compose_validate.js b/frontend_tests/node_tests/compose_validate.js index f060f93f01..bb682ea6c1 100644 --- a/frontend_tests/node_tests/compose_validate.js +++ b/frontend_tests/node_tests/compose_validate.js @@ -11,8 +11,8 @@ const {page_params} = require("../zjsunit/zpage_params"); const {mock_banners} = require("./lib/compose_banner"); -const channel = mock_esm("../../static/js/channel"); -const compose_actions = mock_esm("../../static/js/compose_actions"); +const channel = mock_esm("../../web/src/channel"); +const compose_actions = mock_esm("../../web/src/compose_actions"); const compose_banner = zrequire("compose_banner"); const compose_pm_pill = zrequire("compose_pm_pill"); @@ -20,9 +20,9 @@ const compose_state = zrequire("compose_state"); const compose_validate = zrequire("compose_validate"); const peer_data = zrequire("peer_data"); const people = zrequire("people"); -const resolved_topic = zrequire("../shared/js/resolved_topic"); +const resolved_topic = zrequire("../shared/src/resolved_topic"); const settings_config = zrequire("settings_config"); -const settings_data = mock_esm("../../static/js/settings_data"); +const settings_data = mock_esm("../../web/src/settings_data"); const stream_data = zrequire("stream_data"); const me = { diff --git a/frontend_tests/node_tests/compose_video.js b/frontend_tests/node_tests/compose_video.js index 32820b92ba..4798167fc3 100644 --- a/frontend_tests/node_tests/compose_video.js +++ b/frontend_tests/node_tests/compose_video.js @@ -9,10 +9,10 @@ const {page_params} = require("../zjsunit/zpage_params"); const events = require("./lib/events"); -const channel = mock_esm("../../static/js/channel"); -const compose_ui = mock_esm("../../static/js/compose_ui"); -const upload = mock_esm("../../static/js/upload"); -mock_esm("../../static/js/resize", { +const channel = mock_esm("../../web/src/channel"); +const compose_ui = mock_esm("../../web/src/compose_ui"); +const upload = mock_esm("../../web/src/upload"); +mock_esm("../../web/src/resize", { watch_manual_resize() {}, }); set_global("document", { diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index ee55935150..bae794afc7 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -9,20 +9,20 @@ const {user_settings} = require("../zjsunit/zpage_params"); const noop = () => {}; -const compose = mock_esm("../../static/js/compose", { +const compose = mock_esm("../../web/src/compose", { finish: noop, }); -const compose_validate = mock_esm("../../static/js/compose_validate", { +const compose_validate = mock_esm("../../web/src/compose_validate", { warn_for_text_overflow_when_tries_to_send: () => true, }); -const input_pill = mock_esm("../../static/js/input_pill"); -const message_user_ids = mock_esm("../../static/js/message_user_ids", { +const input_pill = mock_esm("../../web/src/input_pill"); +const message_user_ids = mock_esm("../../web/src/message_user_ids", { user_ids: () => [], }); -const stream_topic_history = mock_esm("../../static/js/stream_topic_history", { +const stream_topic_history = mock_esm("../../web/src/stream_topic_history", { stream_has_topics: () => false, }); -const stream_topic_history_util = mock_esm("../../static/js/stream_topic_history_util"); +const stream_topic_history_util = mock_esm("../../web/src/stream_topic_history_util"); let autosize_called; @@ -34,7 +34,7 @@ set_global("setTimeout", (f, time) => { }); set_global("document", "document-stub"); -const typeahead = zrequire("../shared/js/typeahead"); +const typeahead = zrequire("../shared/src/typeahead"); const compose_state = zrequire("compose_state"); const emoji = zrequire("emoji"); const typeahead_helper = zrequire("typeahead_helper"); diff --git a/frontend_tests/node_tests/copy_and_paste.js b/frontend_tests/node_tests/copy_and_paste.js index 9fccd2bb3e..71c54bffdb 100644 --- a/frontend_tests/node_tests/copy_and_paste.js +++ b/frontend_tests/node_tests/copy_and_paste.js @@ -14,7 +14,7 @@ const {window} = new JSDOM("

Hello world

"); const {document} = window; const $ = jquery(window); -const compose_ui = mock_esm("../../static/js/compose_ui"); +const compose_ui = mock_esm("../../web/src/compose_ui"); set_global("document", document); const copy_and_paste = zrequire("copy_and_paste"); diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index f702d15f92..d3ec47a118 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -24,64 +24,64 @@ const typing_person1 = events.typing_person1; set_global("setTimeout", (func) => func()); -const activity = mock_esm("../../static/js/activity"); -const alert_words_ui = mock_esm("../../static/js/alert_words_ui"); -const attachments_ui = mock_esm("../../static/js/attachments_ui"); -const bot_data = mock_esm("../../static/js/bot_data"); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); -const composebox_typeahead = mock_esm("../../static/js/composebox_typeahead"); -const dark_theme = mock_esm("../../static/js/dark_theme"); -const emoji_picker = mock_esm("../../static/js/emoji_picker"); -const hotspots = mock_esm("../../static/js/hotspots"); -const linkifiers = mock_esm("../../static/js/linkifiers"); -const message_events = mock_esm("../../static/js/message_events"); -const message_lists = mock_esm("../../static/js/message_lists"); -const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui"); -const muted_users_ui = mock_esm("../../static/js/muted_users_ui"); -const notifications = mock_esm("../../static/js/notifications"); -const pm_list = mock_esm("../../static/js/pm_list"); -const reactions = mock_esm("../../static/js/reactions"); -const realm_icon = mock_esm("../../static/js/realm_icon"); -const realm_logo = mock_esm("../../static/js/realm_logo"); -const realm_playground = mock_esm("../../static/js/realm_playground"); -const reload = mock_esm("../../static/js/reload"); -const scroll_bar = mock_esm("../../static/js/scroll_bar"); -const settings_account = mock_esm("../../static/js/settings_account"); -const settings_bots = mock_esm("../../static/js/settings_bots"); -const settings_display = mock_esm("../../static/js/settings_display"); -const settings_emoji = mock_esm("../../static/js/settings_emoji"); -const settings_exports = mock_esm("../../static/js/settings_exports"); -const settings_invites = mock_esm("../../static/js/settings_invites"); -const settings_linkifiers = mock_esm("../../static/js/settings_linkifiers"); -const settings_playgrounds = mock_esm("../../static/js/settings_playgrounds"); -const settings_notifications = mock_esm("../../static/js/settings_notifications"); -const settings_org = mock_esm("../../static/js/settings_org"); -const settings_profile_fields = mock_esm("../../static/js/settings_profile_fields"); +const activity = mock_esm("../../web/src/activity"); +const alert_words_ui = mock_esm("../../web/src/alert_words_ui"); +const attachments_ui = mock_esm("../../web/src/attachments_ui"); +const bot_data = mock_esm("../../web/src/bot_data"); +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); +const composebox_typeahead = mock_esm("../../web/src/composebox_typeahead"); +const dark_theme = mock_esm("../../web/src/dark_theme"); +const emoji_picker = mock_esm("../../web/src/emoji_picker"); +const hotspots = mock_esm("../../web/src/hotspots"); +const linkifiers = mock_esm("../../web/src/linkifiers"); +const message_events = mock_esm("../../web/src/message_events"); +const message_lists = mock_esm("../../web/src/message_lists"); +const muted_topics_ui = mock_esm("../../web/src/muted_topics_ui"); +const muted_users_ui = mock_esm("../../web/src/muted_users_ui"); +const notifications = mock_esm("../../web/src/notifications"); +const pm_list = mock_esm("../../web/src/pm_list"); +const reactions = mock_esm("../../web/src/reactions"); +const realm_icon = mock_esm("../../web/src/realm_icon"); +const realm_logo = mock_esm("../../web/src/realm_logo"); +const realm_playground = mock_esm("../../web/src/realm_playground"); +const reload = mock_esm("../../web/src/reload"); +const scroll_bar = mock_esm("../../web/src/scroll_bar"); +const settings_account = mock_esm("../../web/src/settings_account"); +const settings_bots = mock_esm("../../web/src/settings_bots"); +const settings_display = mock_esm("../../web/src/settings_display"); +const settings_emoji = mock_esm("../../web/src/settings_emoji"); +const settings_exports = mock_esm("../../web/src/settings_exports"); +const settings_invites = mock_esm("../../web/src/settings_invites"); +const settings_linkifiers = mock_esm("../../web/src/settings_linkifiers"); +const settings_playgrounds = mock_esm("../../web/src/settings_playgrounds"); +const settings_notifications = mock_esm("../../web/src/settings_notifications"); +const settings_org = mock_esm("../../web/src/settings_org"); +const settings_profile_fields = mock_esm("../../web/src/settings_profile_fields"); const settings_realm_user_settings_defaults = mock_esm( - "../../static/js/settings_realm_user_settings_defaults", + "../../web/src/settings_realm_user_settings_defaults", ); -const settings_realm_domains = mock_esm("../../static/js/settings_realm_domains"); -const settings_streams = mock_esm("../../static/js/settings_streams"); -const settings_user_groups_legacy = mock_esm("../../static/js/settings_user_groups_legacy"); -const settings_users = mock_esm("../../static/js/settings_users"); -const stream_data = mock_esm("../../static/js/stream_data"); -const stream_events = mock_esm("../../static/js/stream_events"); -const stream_list = mock_esm("../../static/js/stream_list"); -const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui"); -const stream_topic_history = mock_esm("../../static/js/stream_topic_history"); -const submessage = mock_esm("../../static/js/submessage"); -mock_esm("../../static/js/top_left_corner", { +const settings_realm_domains = mock_esm("../../web/src/settings_realm_domains"); +const settings_streams = mock_esm("../../web/src/settings_streams"); +const settings_user_groups_legacy = mock_esm("../../web/src/settings_user_groups_legacy"); +const settings_users = mock_esm("../../web/src/settings_users"); +const stream_data = mock_esm("../../web/src/stream_data"); +const stream_events = mock_esm("../../web/src/stream_events"); +const stream_list = mock_esm("../../web/src/stream_list"); +const stream_settings_ui = mock_esm("../../web/src/stream_settings_ui"); +const stream_topic_history = mock_esm("../../web/src/stream_topic_history"); +const submessage = mock_esm("../../web/src/submessage"); +mock_esm("../../web/src/top_left_corner", { update_starred_count() {}, }); -const typing_events = mock_esm("../../static/js/typing_events"); -const ui = mock_esm("../../static/js/ui"); -const unread_ops = mock_esm("../../static/js/unread_ops"); -const user_events = mock_esm("../../static/js/user_events"); -const user_groups = mock_esm("../../static/js/user_groups"); -const user_group_edit = mock_esm("../../static/js/user_group_edit"); -const overlays = mock_esm("../../static/js/overlays"); -const user_groups_settings_ui = mock_esm("../../static/js/user_groups_settings_ui"); -mock_esm("../../static/js/giphy"); +const typing_events = mock_esm("../../web/src/typing_events"); +const ui = mock_esm("../../web/src/ui"); +const unread_ops = mock_esm("../../web/src/unread_ops"); +const user_events = mock_esm("../../web/src/user_events"); +const user_groups = mock_esm("../../web/src/user_groups"); +const user_group_edit = mock_esm("../../web/src/user_group_edit"); +const overlays = mock_esm("../../web/src/overlays"); +const user_groups_settings_ui = mock_esm("../../web/src/user_groups_settings_ui"); +mock_esm("../../web/src/giphy"); const electron_bridge = set_global("electron_bridge", {}); @@ -125,7 +125,7 @@ people.add_active_user(test_user); message_helper.process_new_message(test_message); const realm_emoji = {}; -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); emoji.initialize({realm_emoji, emoji_codes}); diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js index 086ed3cf7e..43cdb2698d 100644 --- a/frontend_tests/node_tests/dispatch_subs.js +++ b/frontend_tests/node_tests/dispatch_subs.js @@ -13,15 +13,15 @@ const events = require("./lib/events"); const event_fixtures = events.fixtures; const test_user = events.test_user; -const compose_fade = mock_esm("../../static/js/compose_fade"); -const message_lists = mock_esm("../../static/js/message_lists"); -const narrow_state = mock_esm("../../static/js/narrow_state"); -const overlays = mock_esm("../../static/js/overlays"); -const settings_org = mock_esm("../../static/js/settings_org"); -const settings_streams = mock_esm("../../static/js/settings_streams"); -const stream_events = mock_esm("../../static/js/stream_events"); -const stream_list = mock_esm("../../static/js/stream_list"); -const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui"); +const compose_fade = mock_esm("../../web/src/compose_fade"); +const message_lists = mock_esm("../../web/src/message_lists"); +const narrow_state = mock_esm("../../web/src/narrow_state"); +const overlays = mock_esm("../../web/src/overlays"); +const settings_org = mock_esm("../../web/src/settings_org"); +const settings_streams = mock_esm("../../web/src/settings_streams"); +const stream_events = mock_esm("../../web/src/stream_events"); +const stream_list = mock_esm("../../web/src/stream_list"); +const stream_settings_ui = mock_esm("../../web/src/stream_settings_ui"); message_lists.current = {}; const peer_data = zrequire("peer_data"); diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index 4b4d07a5c3..512c8b72d2 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -29,10 +29,10 @@ set_global("setTimeout", (f, delay) => { assert.equal(delay, setTimeout_delay); f(); }); -mock_esm("../../static/js/markdown", { +mock_esm("../../web/src/markdown", { apply_markdown: noop, }); -mock_esm("../../static/js/overlays", { +mock_esm("../../web/src/overlays", { open_overlay: noop, }); diff --git a/frontend_tests/node_tests/dropdown_list_widget.js b/frontend_tests/node_tests/dropdown_list_widget.js index 3392c1918a..66a38e88a6 100644 --- a/frontend_tests/node_tests/dropdown_list_widget.js +++ b/frontend_tests/node_tests/dropdown_list_widget.js @@ -9,7 +9,7 @@ const blueslip = require("../zjsunit/zblueslip"); const $ = require("../zjsunit/zjquery"); const noop = () => {}; -mock_esm("../../static/js/list_widget", { +mock_esm("../../web/src/list_widget", { create: () => ({init: noop}), }); diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index b2a9e2e206..49b910aba3 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -9,23 +9,23 @@ const {make_stub} = require("../zjsunit/stub"); const {run_test} = require("../zjsunit/test"); const {page_params} = require("../zjsunit/zpage_params"); -const markdown = mock_esm("../../static/js/markdown"); -const message_lists = mock_esm("../../static/js/message_lists"); -const notifications = mock_esm("../../static/js/notifications"); +const markdown = mock_esm("../../web/src/markdown"); +const message_lists = mock_esm("../../web/src/message_lists"); +const notifications = mock_esm("../../web/src/notifications"); let disparities = []; -mock_esm("../../static/js/ui", { +mock_esm("../../web/src/ui", { show_failed_message_success() {}, }); -mock_esm("../../static/js/sent_messages", { +mock_esm("../../web/src/sent_messages", { mark_disparity(local_id) { disparities.push(local_id); }, }); -const message_store = mock_esm("../../static/js/message_store", { +const message_store = mock_esm("../../web/src/message_store", { get: () => ({failed_request: true}), update_booleans() {}, diff --git a/frontend_tests/node_tests/emoji.js b/frontend_tests/node_tests/emoji.js index a16c7bb516..e6aa9eb84e 100644 --- a/frontend_tests/node_tests/emoji.js +++ b/frontend_tests/node_tests/emoji.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); const events = require("./lib/events"); diff --git a/frontend_tests/node_tests/emoji_picker.js b/frontend_tests/node_tests/emoji_picker.js index 5aeb4541e7..f915cbf2e7 100644 --- a/frontend_tests/node_tests/emoji_picker.js +++ b/frontend_tests/node_tests/emoji_picker.js @@ -10,7 +10,7 @@ const {run_test} = require("../zjsunit/test"); const emoji = zrequire("emoji"); const emoji_picker = zrequire("emoji_picker"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); run_test("initialize", () => { emoji.initialize({ diff --git a/frontend_tests/node_tests/event_status.js b/frontend_tests/node_tests/event_status.js index 40db98864f..bf080e7ae3 100644 --- a/frontend_tests/node_tests/event_status.js +++ b/frontend_tests/node_tests/event_status.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); const event_status = zrequire("billing/event_status"); -const helpers = mock_esm("../../static/js/billing/helpers"); +const helpers = mock_esm("../../web/src/billing/helpers"); run_test("initialize_retry_with_another_card_link_click_handler", ({override}) => { override(helpers, "create_ajax_request", (url, form_name, ignored_inputs, method, callback) => { diff --git a/frontend_tests/node_tests/example3.js b/frontend_tests/node_tests/example3.js index 5551d8849e..3452370c68 100644 --- a/frontend_tests/node_tests/example3.js +++ b/frontend_tests/node_tests/example3.js @@ -11,7 +11,7 @@ const {page_params} = require("../zjsunit/zpage_params"); // narrows more broadly, but first let's test out a core piece of // code that makes things work. -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const stream_data = zrequire("stream_data"); // This is the first time we have to deal with page_params. diff --git a/frontend_tests/node_tests/example4.js b/frontend_tests/node_tests/example4.js index f80fafe022..9c744e1e5e 100644 --- a/frontend_tests/node_tests/example4.js +++ b/frontend_tests/node_tests/example4.js @@ -55,10 +55,10 @@ const {run_test} = require("../zjsunit/test"); */ // We are going to use mock versions of some of our libraries. -const activity = mock_esm("../../static/js/activity"); -const message_live_update = mock_esm("../../static/js/message_live_update"); -const pm_list = mock_esm("../../static/js/pm_list"); -const settings_users = mock_esm("../../static/js/settings_users"); +const activity = mock_esm("../../web/src/activity"); +const message_live_update = mock_esm("../../web/src/message_live_update"); +const pm_list = mock_esm("../../web/src/pm_list"); +const settings_users = mock_esm("../../web/src/settings_users"); // Use real versions of these modules. const people = zrequire("people"); diff --git a/frontend_tests/node_tests/example5.js b/frontend_tests/node_tests/example5.js index 26cdd498fb..14ff97d0ec 100644 --- a/frontend_tests/node_tests/example5.js +++ b/frontend_tests/node_tests/example5.js @@ -20,15 +20,15 @@ const {run_test} = require("../zjsunit/test"); // First we tell the compiler to skip certain modules and just // replace them with {}. -const huddle_data = mock_esm("../../static/js/huddle_data"); -const message_lists = mock_esm("../../static/js/message_lists"); -const message_util = mock_esm("../../static/js/message_util"); -const notifications = mock_esm("../../static/js/notifications"); -const pm_list = mock_esm("../../static/js/pm_list"); -const recent_topics_data = mock_esm("../../static/js/recent_topics_data"); -const stream_list = mock_esm("../../static/js/stream_list"); -const unread_ops = mock_esm("../../static/js/unread_ops"); -const unread_ui = mock_esm("../../static/js/unread_ui"); +const huddle_data = mock_esm("../../web/src/huddle_data"); +const message_lists = mock_esm("../../web/src/message_lists"); +const message_util = mock_esm("../../web/src/message_util"); +const notifications = mock_esm("../../web/src/notifications"); +const pm_list = mock_esm("../../web/src/pm_list"); +const recent_topics_data = mock_esm("../../web/src/recent_topics_data"); +const stream_list = mock_esm("../../web/src/stream_list"); +const unread_ops = mock_esm("../../web/src/unread_ops"); +const unread_ui = mock_esm("../../web/src/unread_ui"); message_lists.home = {}; diff --git a/frontend_tests/node_tests/example7.js b/frontend_tests/node_tests/example7.js index 342a615fbf..d94e3519e2 100644 --- a/frontend_tests/node_tests/example7.js +++ b/frontend_tests/node_tests/example7.js @@ -49,11 +49,11 @@ const {run_test} = require("../zjsunit/test"); value.) */ -const channel = mock_esm("../../static/js/channel"); -const message_lists = mock_esm("../../static/js/message_lists"); -const message_viewport = mock_esm("../../static/js/message_viewport"); -const notifications = mock_esm("../../static/js/notifications"); -const unread_ui = mock_esm("../../static/js/unread_ui"); +const channel = mock_esm("../../web/src/channel"); +const message_lists = mock_esm("../../web/src/message_lists"); +const message_viewport = mock_esm("../../web/src/message_viewport"); +const notifications = mock_esm("../../web/src/notifications"); +const unread_ui = mock_esm("../../web/src/unread_ui"); message_lists.current = {}; message_lists.home = {}; diff --git a/frontend_tests/node_tests/example8.js b/frontend_tests/node_tests/example8.js index d3931ae1ff..68a7e41063 100644 --- a/frontend_tests/node_tests/example8.js +++ b/frontend_tests/node_tests/example8.js @@ -90,7 +90,7 @@ run_test("typing_events.render_notifications_for_narrow", ({override, mock_templ const two_typing_users_rendered_html = "Two typing users rendered html stub"; // As you can see below, the first argument of mock_template takes - // the relative path of the template we want to mock w.r.t static/templates/ + // the relative path of the template we want to mock w.r.t web/templates/ // // The second argument takes a boolean determining whether to render html. // We mostly set this to `false` and recommend you avoid setting this to `true` diff --git a/frontend_tests/node_tests/fenced_code.js b/frontend_tests/node_tests/fenced_code.js index df7e1da383..dbd42db3de 100644 --- a/frontend_tests/node_tests/fenced_code.js +++ b/frontend_tests/node_tests/fenced_code.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const fenced_code = zrequire("../shared/js/fenced_code"); +const fenced_code = zrequire("../shared/src/fenced_code"); // Check the default behavior of fenced code blocks // works properly before Markdown is initialized. diff --git a/frontend_tests/node_tests/fetch_status.js b/frontend_tests/node_tests/fetch_status.js index 34e1ebaee8..8984254e2c 100644 --- a/frontend_tests/node_tests/fetch_status.js +++ b/frontend_tests/node_tests/fetch_status.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -mock_esm("../../static/js/message_scroll", { +mock_esm("../../web/src/message_scroll", { hide_loading_older() {}, show_loading_older() {}, diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js index bf4ec69bd8..03f43719a5 100644 --- a/frontend_tests/node_tests/filter.js +++ b/frontend_tests/node_tests/filter.js @@ -10,12 +10,12 @@ const blueslip = require("../zjsunit/zblueslip"); const $ = require("../zjsunit/zjquery"); const {page_params} = require("../zjsunit/zpage_params"); -const message_store = mock_esm("../../static/js/message_store"); +const message_store = mock_esm("../../web/src/message_store"); -const resolved_topic = zrequire("../shared/js/resolved_topic"); +const resolved_topic = zrequire("../shared/src/resolved_topic"); const stream_data = zrequire("stream_data"); const people = zrequire("people"); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const me = { email: "me@example.com", diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js index 98625fef02..e173952fbc 100644 --- a/frontend_tests/node_tests/hashchange.js +++ b/frontend_tests/node_tests/hashchange.js @@ -11,24 +11,24 @@ const {user_settings} = require("../zjsunit/zpage_params"); let $window_stub; set_global("to_$", () => $window_stub); -mock_esm("../../static/js/search", { +mock_esm("../../web/src/search", { update_button_visibility() {}, }); set_global("document", "document-stub"); const history = set_global("history", {}); -const admin = mock_esm("../../static/js/admin"); -const drafts = mock_esm("../../static/js/drafts"); -const info_overlay = mock_esm("../../static/js/info_overlay"); -const message_viewport = mock_esm("../../static/js/message_viewport"); -const narrow = mock_esm("../../static/js/narrow"); -const overlays = mock_esm("../../static/js/overlays"); -const recent_topics_ui = mock_esm("../../static/js/recent_topics_ui"); -const settings = mock_esm("../../static/js/settings"); -const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui"); -const ui_util = mock_esm("../../static/js/ui_util"); -const ui_report = mock_esm("../../static/js/ui_report"); -mock_esm("../../static/js/top_left_corner", { +const admin = mock_esm("../../web/src/admin"); +const drafts = mock_esm("../../web/src/drafts"); +const info_overlay = mock_esm("../../web/src/info_overlay"); +const message_viewport = mock_esm("../../web/src/message_viewport"); +const narrow = mock_esm("../../web/src/narrow"); +const overlays = mock_esm("../../web/src/overlays"); +const recent_topics_ui = mock_esm("../../web/src/recent_topics_ui"); +const settings = mock_esm("../../web/src/settings"); +const stream_settings_ui = mock_esm("../../web/src/stream_settings_ui"); +const ui_util = mock_esm("../../web/src/ui_util"); +const ui_report = mock_esm("../../web/src/ui_report"); +mock_esm("../../web/src/top_left_corner", { handle_narrow_deactivated() {}, }); set_global("favicon", {}); diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index e441e3b0d4..bed835fe32 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -31,24 +31,24 @@ set_global("navigator", { // jQuery stuff should go away if we make an initialize() method. set_global("document", "document-stub"); -const browser_history = mock_esm("../../static/js/browser_history"); -const compose_actions = mock_esm("../../static/js/compose_actions"); -const condense = mock_esm("../../static/js/condense"); -const drafts = mock_esm("../../static/js/drafts"); -const emoji_picker = mock_esm("../../static/js/emoji_picker", { +const browser_history = mock_esm("../../web/src/browser_history"); +const compose_actions = mock_esm("../../web/src/compose_actions"); +const condense = mock_esm("../../web/src/condense"); +const drafts = mock_esm("../../web/src/drafts"); +const emoji_picker = mock_esm("../../web/src/emoji_picker", { reactions_popped: () => false, }); -const gear_menu = mock_esm("../../static/js/gear_menu", { +const gear_menu = mock_esm("../../web/src/gear_menu", { is_open: () => false, }); -const lightbox = mock_esm("../../static/js/lightbox"); -const list_util = mock_esm("../../static/js/list_util"); -const message_edit = mock_esm("../../static/js/message_edit"); -const message_lists = mock_esm("../../static/js/message_lists"); -const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui"); -const narrow = mock_esm("../../static/js/narrow"); -const navigate = mock_esm("../../static/js/navigate"); -const overlays = mock_esm("../../static/js/overlays", { +const lightbox = mock_esm("../../web/src/lightbox"); +const list_util = mock_esm("../../web/src/list_util"); +const message_edit = mock_esm("../../web/src/message_edit"); +const message_lists = mock_esm("../../web/src/message_lists"); +const muted_topics_ui = mock_esm("../../web/src/muted_topics_ui"); +const narrow = mock_esm("../../web/src/narrow"); +const navigate = mock_esm("../../web/src/navigate"); +const overlays = mock_esm("../../web/src/overlays", { is_active: () => false, settings_open: () => false, streams_open: () => false, @@ -58,31 +58,31 @@ const overlays = mock_esm("../../static/js/overlays", { is_modal_open: () => false, is_overlay_or_modal_open: () => overlays.is_modal_open() || overlays.is_active(), }); -const popovers = mock_esm("../../static/js/popovers", { +const popovers = mock_esm("../../web/src/popovers", { user_info_manage_menu_popped: () => false, message_info_popped: () => false, user_sidebar_popped: () => false, user_info_popped: () => false, }); -const popover_menus = mock_esm("../../static/js/popover_menus", { +const popover_menus = mock_esm("../../web/src/popover_menus", { actions_popped: () => false, }); -const reactions = mock_esm("../../static/js/reactions"); -const search = mock_esm("../../static/js/search"); -const settings_data = mock_esm("../../static/js/settings_data"); -const stream_list = mock_esm("../../static/js/stream_list"); -const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui"); +const reactions = mock_esm("../../web/src/reactions"); +const search = mock_esm("../../web/src/search"); +const settings_data = mock_esm("../../web/src/settings_data"); +const stream_list = mock_esm("../../web/src/stream_list"); +const stream_settings_ui = mock_esm("../../web/src/stream_settings_ui"); -mock_esm("../../static/js/hotspots", { +mock_esm("../../web/src/hotspots", { is_open: () => false, }); -mock_esm("../../static/js/recent_topics_util", { +mock_esm("../../web/src/recent_topics_util", { is_visible: () => false, is_in_focus: () => false, }); -const stream_popover = mock_esm("../../static/js/stream_popover", { +const stream_popover = mock_esm("../../web/src/stream_popover", { stream_popped: () => false, topic_popped: () => false, all_messages_popped: () => false, @@ -109,7 +109,7 @@ message_lists.current = { const activity = zrequire("activity"); const emoji = zrequire("emoji"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); const hotkey = zrequire("hotkey"); emoji.initialize({ diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.js index e0db82a237..d0361993d1 100644 --- a/frontend_tests/node_tests/i18n.js +++ b/frontend_tests/node_tests/i18n.js @@ -22,13 +22,13 @@ page_params.translation_data = { // Re-register Zulip extensions so extensions registered previously with // mocked i18n.ts do not interfere with following tests. -require("../../static/js/templates"); +require("../../web/src/templates"); // All of our other tests stub out i18n activity; // here we do a quick sanity check on the engine itself. // `i18n.js` initializes FormatJS and is imported by // `templates.js`. -unmock_module("../../static/js/i18n"); +unmock_module("../../web/src/i18n"); const {$t, $t_html, get_language_name, get_language_list_columns, initialize} = zrequire("i18n"); run_test("$t", () => { @@ -89,7 +89,7 @@ run_test("t_tag", ({mock_template}) => { assert.ok(html.indexOf("Citer et répondre ou transférer") > 0); }); - require("../../static/templates/actions_popover_content.hbs")(args); + require("../../web/templates/actions_popover_content.hbs")(args); }); run_test("tr_tag", ({mock_template}) => { @@ -117,7 +117,7 @@ run_test("tr_tag", ({mock_template}) => { assert.equal(data, args); assert.ok(html.indexOf("Déclencheurs de notification") > 0); }); - require("../../static/templates/settings_tab.hbs")(args); + require("../../web/templates/settings_tab.hbs")(args); }); run_test("language_list", () => { diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index 1678264141..a21d6ae4c6 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -12,7 +12,7 @@ set_global("document", {}); const noop = () => {}; const example_img_link = "http://example.com/example.png"; -mock_esm("../../static/js/ui_util", { +mock_esm("../../web/src/ui_util", { place_caret_at_end: noop, }); @@ -40,7 +40,7 @@ function pill_html(value, img_src, status_emoji_info) { opts.status_emoji_info = status_emoji_info; } - return require("../../static/templates/input_pill.hbs")(opts); + return require("../../web/templates/input_pill.hbs")(opts); } run_test("basics", ({mock_template}) => { diff --git a/frontend_tests/node_tests/internal_url.js b/frontend_tests/node_tests/internal_url.js index 8e1e0d4246..88ffd75b49 100644 --- a/frontend_tests/node_tests/internal_url.js +++ b/frontend_tests/node_tests/internal_url.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const internal_url = zrequire("../shared/js/internal_url"); +const internal_url = zrequire("../shared/src/internal_url"); run_test("test encodeHashComponent", () => { const decoded = "https://www.zulipexample.com"; diff --git a/frontend_tests/node_tests/lib/compose_banner.js b/frontend_tests/node_tests/lib/compose_banner.js index 8249afe605..0055e768b1 100644 --- a/frontend_tests/node_tests/lib/compose_banner.js +++ b/frontend_tests/node_tests/lib/compose_banner.js @@ -1,6 +1,6 @@ "use strict"; -const compose_banner = require("../../../static/js/compose_banner"); +const compose_banner = require("../../../web/src/compose_banner"); const $ = require("../../zjsunit/zjquery"); exports.mock_banners = () => { diff --git a/frontend_tests/node_tests/lightbox.js b/frontend_tests/node_tests/lightbox.js index 280a9d44bf..87405b5114 100644 --- a/frontend_tests/node_tests/lightbox.js +++ b/frontend_tests/node_tests/lightbox.js @@ -7,18 +7,18 @@ const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); set_global("Image", class Image {}); -mock_esm("../../static/js/overlays", { +mock_esm("../../web/src/overlays", { close_overlay() {}, close_active() {}, open_overlay() {}, }); -mock_esm("../../static/js/popovers", { +mock_esm("../../web/src/popovers", { hide_all() {}, }); -const rows = mock_esm("../../static/js/rows"); +const rows = mock_esm("../../web/src/rows"); -const message_store = mock_esm("../../static/js/message_store"); +const message_store = mock_esm("../../web/src/message_store"); const lightbox = zrequire("lightbox"); diff --git a/frontend_tests/node_tests/list_widget.js b/frontend_tests/node_tests/list_widget.js index 3e07c7be9d..41cb63fced 100644 --- a/frontend_tests/node_tests/list_widget.js +++ b/frontend_tests/node_tests/list_widget.js @@ -10,7 +10,7 @@ const blueslip = require("../zjsunit/zblueslip"); // The ListWidget library allows you to insert objects // that are either jQuery, Element, or just raw HTML // strings. We initially test with raw strings. -const ui = mock_esm("../../static/js/ui"); +const ui = mock_esm("../../web/src/ui"); // We only need very simple jQuery wrappers for when the diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 95c101b5b0..d9ec9ce834 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -30,10 +30,10 @@ user_settings.translate_emoticons = false; set_global("document", {compatMode: "CSS1Compat"}); const emoji = zrequire("emoji"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); const linkifiers = zrequire("linkifiers"); const pygments_data = zrequire("../generated/pygments_data.json"); -const fenced_code = zrequire("../shared/js/fenced_code"); +const fenced_code = zrequire("../shared/src/fenced_code"); const markdown_config = zrequire("markdown_config"); const markdown = zrequire("markdown"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index ffd8e73cb8..f3f5d80c98 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -12,7 +12,7 @@ const message_edit = zrequire("message_edit"); const is_content_editable = message_edit.is_content_editable; -const settings_data = mock_esm("../../static/js/settings_data"); +const settings_data = mock_esm("../../web/src/settings_data"); run_test("is_content_editable", () => { // You can't edit a null message diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js index 1f45902815..3a84c28bb1 100644 --- a/frontend_tests/node_tests/message_events.js +++ b/frontend_tests/node_tests/message_events.js @@ -7,13 +7,13 @@ const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); const {page_params} = require("../zjsunit/zpage_params"); -const condense = mock_esm("../../static/js/condense"); -const message_edit = mock_esm("../../static/js/message_edit"); -const message_lists = mock_esm("../../static/js/message_lists"); -const notifications = mock_esm("../../static/js/notifications"); -const pm_list = mock_esm("../../static/js/pm_list"); -const stream_list = mock_esm("../../static/js/stream_list"); -const unread_ui = mock_esm("../../static/js/unread_ui"); +const condense = mock_esm("../../web/src/condense"); +const message_edit = mock_esm("../../web/src/message_edit"); +const message_lists = mock_esm("../../web/src/message_lists"); +const notifications = mock_esm("../../web/src/notifications"); +const pm_list = mock_esm("../../web/src/pm_list"); +const stream_list = mock_esm("../../web/src/stream_list"); +const unread_ui = mock_esm("../../web/src/unread_ui"); message_lists.current = {}; message_lists.all_rendered_message_lists = () => [message_lists.home, message_lists.current]; diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js index 552874bbb8..5e8c4a17a7 100644 --- a/frontend_tests/node_tests/message_fetch.js +++ b/frontend_tests/node_tests/message_fetch.js @@ -20,27 +20,27 @@ function MessageListView() { prepend: noop, }; } -mock_esm("../../static/js/message_list_view", { +mock_esm("../../web/src/message_list_view", { MessageListView, }); -mock_esm("../../static/js/recent_topics_ui", { +mock_esm("../../web/src/recent_topics_ui", { process_messages: noop, show_loading_indicator: noop, hide_loading_indicator: noop, }); -mock_esm("../../static/js/ui_report", { +mock_esm("../../web/src/ui_report", { hide_error: noop, }); -const channel = mock_esm("../../static/js/channel"); -const message_helper = mock_esm("../../static/js/message_helper"); -const message_lists = mock_esm("../../static/js/message_lists"); -const message_util = mock_esm("../../static/js/message_util"); -const stream_list = mock_esm("../../static/js/stream_list", { +const channel = mock_esm("../../web/src/channel"); +const message_helper = mock_esm("../../web/src/message_helper"); +const message_lists = mock_esm("../../web/src/message_lists"); +const message_util = mock_esm("../../web/src/message_util"); +const stream_list = mock_esm("../../web/src/stream_list", { maybe_scroll_narrow_into_view() {}, }); -mock_esm("../../static/js/message_scroll", { +mock_esm("../../web/src/message_scroll", { show_loading_older: noop, hide_loading_older: noop, show_loading_newer: noop, @@ -52,7 +52,7 @@ set_global("document", "document-stub"); const message_fetch = zrequire("message_fetch"); const {all_messages_data} = zrequire("all_messages_data"); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const message_list = zrequire("message_list"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/message_flags.js b/frontend_tests/node_tests/message_flags.js index 3918a4eb6c..73d391108b 100644 --- a/frontend_tests/node_tests/message_flags.js +++ b/frontend_tests/node_tests/message_flags.js @@ -5,10 +5,10 @@ const {strict: assert} = require("assert"); const {mock_esm, set_global, with_overrides, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const channel = mock_esm("../../static/js/channel"); -const ui = mock_esm("../../static/js/ui"); +const channel = mock_esm("../../web/src/channel"); +const ui = mock_esm("../../web/src/ui"); -mock_esm("../../static/js/starred_messages", { +mock_esm("../../web/src/starred_messages", { add() {}, get_starred_msg_ids: () => [1, 2, 3, 4, 5], remove() {}, diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js index afdabbf479..99efd69fd0 100644 --- a/frontend_tests/node_tests/message_list.js +++ b/frontend_tests/node_tests/message_list.js @@ -9,7 +9,7 @@ const blueslip = require("../zjsunit/zblueslip"); const $ = require("../zjsunit/zjquery"); const {page_params} = require("../zjsunit/zpage_params"); -// These unit tests for static/js/message_list.js emphasize the model-ish +// These unit tests for web/src/message_list.js emphasize the model-ish // aspects of the MessageList class. We have to stub out a few functions // related to views and events to get the tests working. @@ -23,8 +23,8 @@ set_global("document", { }, }); -const narrow_state = mock_esm("../../static/js/narrow_state"); -const stream_data = mock_esm("../../static/js/stream_data"); +const narrow_state = mock_esm("../../web/src/narrow_state"); +const stream_data = mock_esm("../../web/src/stream_data"); const {MessageList} = zrequire("message_list"); function MessageListView() { @@ -35,7 +35,7 @@ function MessageListView() { clear_rendering_state: noop, }; } -mock_esm("../../static/js/message_list_view", { +mock_esm("../../web/src/message_list_view", { MessageListView, }); const {Filter} = zrequire("filter"); diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.js index 886776f876..9df7f505e4 100644 --- a/frontend_tests/node_tests/message_list_data.js +++ b/frontend_tests/node_tests/message_list_data.js @@ -8,7 +8,7 @@ const blueslip = require("../zjsunit/zblueslip"); const user_topics = zrequire("user_topics"); const muted_users = zrequire("muted_users"); -const {MessageListData} = zrequire("../js/message_list_data"); +const {MessageListData} = zrequire("../src/message_list_data"); const {Filter} = zrequire("filter"); function make_msg(msg_id) { diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index 5c15e9aabb..41e3a44de1 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -13,7 +13,7 @@ set_global("document", "document-stub"); const noop = () => {}; // timerender calls setInterval when imported -mock_esm("../../static/js/timerender", { +mock_esm("../../web/src/timerender", { render_date(time) { return [{outerHTML: String(time.getTime())}]; }, @@ -22,7 +22,7 @@ mock_esm("../../static/js/timerender", { }, }); -mock_esm("../../static/js/rows", { +mock_esm("../../web/src/rows", { get_table() { return { children() { @@ -34,14 +34,14 @@ mock_esm("../../static/js/rows", { }, }); -mock_esm("../../static/js/people", { +mock_esm("../../web/src/people", { sender_is_bot: () => false, sender_is_guest: () => false, small_avatar_url: () => "fake/small/avatar/url", }); -const {Filter} = zrequire("../js/filter"); -const {MessageListView} = zrequire("../js/message_list_view"); +const {Filter} = zrequire("../src/filter"); +const {MessageListView} = zrequire("../src/message_list_view"); const message_list = zrequire("message_list"); const muted_users = zrequire("muted_users"); diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index 52c7b0ba20..dbf12d6ba0 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -9,11 +9,11 @@ const {page_params} = require("../zjsunit/zpage_params"); const noop = () => {}; -mock_esm("../../static/js/stream_topic_history", { +mock_esm("../../web/src/stream_topic_history", { add_message: noop, }); -mock_esm("../../static/js/recent_senders", { +mock_esm("../../web/src/recent_senders", { process_stream_message: noop, process_private_message: noop, }); diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index 801a47bce1..554c62e8c3 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -14,15 +14,15 @@ const narrow_banner = zrequire("narrow_banner"); const narrow_state = zrequire("narrow_state"); const people = zrequire("people"); const stream_data = zrequire("stream_data"); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const narrow = zrequire("narrow"); const settings_config = zrequire("settings_config"); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); -mock_esm("../../static/js/spectators", { +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); +mock_esm("../../web/src/spectators", { login_to_access() {}, }); -const recent_topics_util = mock_esm("../../static/js/recent_topics_util", { +const recent_topics_util = mock_esm("../../web/src/recent_topics_util", { is_visible() {}, }); @@ -32,7 +32,7 @@ function empty_narrow_html(title, html, search_data) { html, search_data, }; - return require("../../static/templates/empty_feed_notice.hbs")(opts); + return require("../../web/templates/empty_feed_notice.hbs")(opts); } function set_filter(operators) { diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index 8ee172ee9b..fe9904b605 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -6,34 +6,34 @@ const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -mock_esm("../../static/js/resize", { +mock_esm("../../web/src/resize", { resize_stream_filters_container() {}, }); -const all_messages_data = mock_esm("../../static/js/all_messages_data"); -const channel = mock_esm("../../static/js/channel"); -const compose_actions = mock_esm("../../static/js/compose_actions"); -const compose_banner = mock_esm("../../static/js/compose_banner"); -const compose_closed_ui = mock_esm("../../static/js/compose_closed_ui"); -const hashchange = mock_esm("../../static/js/hashchange"); -const message_fetch = mock_esm("../../static/js/message_fetch"); -const message_list = mock_esm("../../static/js/message_list"); -const message_lists = mock_esm("../../static/js/message_lists", { +const all_messages_data = mock_esm("../../web/src/all_messages_data"); +const channel = mock_esm("../../web/src/channel"); +const compose_actions = mock_esm("../../web/src/compose_actions"); +const compose_banner = mock_esm("../../web/src/compose_banner"); +const compose_closed_ui = mock_esm("../../web/src/compose_closed_ui"); +const hashchange = mock_esm("../../web/src/hashchange"); +const message_fetch = mock_esm("../../web/src/message_fetch"); +const message_list = mock_esm("../../web/src/message_list"); +const message_lists = mock_esm("../../web/src/message_lists", { home: {}, current: {}, set_current(msg_list) { message_lists.current = msg_list; }, }); -const message_scroll = mock_esm("../../static/js/message_scroll"); -const message_view_header = mock_esm("../../static/js/message_view_header"); -const notifications = mock_esm("../../static/js/notifications"); -const search = mock_esm("../../static/js/search"); -const stream_list = mock_esm("../../static/js/stream_list"); -const top_left_corner = mock_esm("../../static/js/top_left_corner"); -const typing_events = mock_esm("../../static/js/typing_events"); -const unread_ops = mock_esm("../../static/js/unread_ops"); -mock_esm("../../static/js/recent_topics_util", { +const message_scroll = mock_esm("../../web/src/message_scroll"); +const message_view_header = mock_esm("../../web/src/message_view_header"); +const notifications = mock_esm("../../web/src/notifications"); +const search = mock_esm("../../web/src/search"); +const stream_list = mock_esm("../../web/src/stream_list"); +const top_left_corner = mock_esm("../../web/src/top_left_corner"); +const typing_events = mock_esm("../../web/src/typing_events"); +const unread_ops = mock_esm("../../web/src/unread_ops"); +mock_esm("../../web/src/recent_topics_util", { is_visible() {}, }); @@ -45,7 +45,7 @@ set_global("setTimeout", (f, t) => { f(); }); -mock_esm("../../static/js/user_topics", { +mock_esm("../../web/src/user_topics", { is_topic_muted: () => false, }); diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js index 9ee9bf8b0b..42a62b5c0b 100644 --- a/frontend_tests/node_tests/narrow_local.js +++ b/frontend_tests/node_tests/narrow_local.js @@ -5,13 +5,13 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const all_messages_data = mock_esm("../../static/js/all_messages_data"); +const all_messages_data = mock_esm("../../web/src/all_messages_data"); -const {Filter} = zrequire("../js/filter"); -const {MessageListData} = zrequire("../js/message_list_data"); +const {Filter} = zrequire("../src/filter"); +const {MessageListData} = zrequire("../src/message_list_data"); const narrow_state = zrequire("narrow_state"); const narrow = zrequire("narrow"); -const resolved_topic = zrequire("../shared/js/resolved_topic"); +const resolved_topic = zrequire("../shared/src/resolved_topic"); function test_with(fixture) { const filter = new Filter(fixture.filter_terms); diff --git a/frontend_tests/node_tests/narrow_state.js b/frontend_tests/node_tests/narrow_state.js index 9b62fd2eef..b3d520a33f 100644 --- a/frontend_tests/node_tests/narrow_state.js +++ b/frontend_tests/node_tests/narrow_state.js @@ -6,7 +6,7 @@ const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const stream_data = zrequire("stream_data"); const narrow_state = zrequire("narrow_state"); diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.js index 637a773e9d..dc61774475 100644 --- a/frontend_tests/node_tests/narrow_unread.js +++ b/frontend_tests/node_tests/narrow_unread.js @@ -6,11 +6,11 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); -mock_esm("../../static/js/user_topics", { +mock_esm("../../web/src/user_topics", { is_topic_muted: () => false, }); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const message_store = zrequire("message_store"); const people = zrequire("people"); const stream_data = zrequire("stream_data"); diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 3506d08fb2..cebcacca2d 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -12,7 +12,7 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const {page_params, user_settings} = require("../zjsunit/zpage_params"); -const message_user_ids = mock_esm("../../static/js/message_user_ids"); +const message_user_ids = mock_esm("../../web/src/message_user_ids"); const muted_users = zrequire("muted_users"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js index c414860d57..180a5a5472 100644 --- a/frontend_tests/node_tests/people_errors.js +++ b/frontend_tests/node_tests/people_errors.js @@ -6,7 +6,7 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); -const reload_state = mock_esm("../../static/js/reload_state", { +const reload_state = mock_esm("../../web/src/reload_state", { is_in_progress: () => false, }); diff --git a/frontend_tests/node_tests/pill_typeahead.js b/frontend_tests/node_tests/pill_typeahead.js index 6f292a33f5..5be6a8bdb0 100644 --- a/frontend_tests/node_tests/pill_typeahead.js +++ b/frontend_tests/node_tests/pill_typeahead.js @@ -23,7 +23,7 @@ const $fake_rendered_person = $.create("fake-rendered-person"); const $fake_rendered_stream = $.create("fake-rendered-stream"); const $fake_rendered_group = $.create("fake-rendered-group"); -mock_esm("../../static/js/typeahead_helper", { +mock_esm("../../web/src/typeahead_helper", { render_person() { return $fake_rendered_person; }, diff --git a/frontend_tests/node_tests/pm_list_data.js b/frontend_tests/node_tests/pm_list_data.js index 2e4578fde1..f233d84296 100644 --- a/frontend_tests/node_tests/pm_list_data.js +++ b/frontend_tests/node_tests/pm_list_data.js @@ -5,9 +5,9 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const unread = mock_esm("../../static/js/unread"); +const unread = mock_esm("../../web/src/unread"); -mock_esm("../../static/js/user_status", { +mock_esm("../../web/src/user_status", { get_status_emoji: () => ({ emoji_code: 20, }), diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js index 53b71bb8ae..fd921569e3 100644 --- a/frontend_tests/node_tests/poll_widget.js +++ b/frontend_tests/node_tests/poll_widget.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const $ = require("../zjsunit/zjquery"); -const {PollData} = zrequire("../../static/shared/js/poll_data"); +const {PollData} = zrequire("../../web/shared/src/poll_data"); const poll_widget = zrequire("poll_widget"); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index 9137888da0..9f015a4a29 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -15,21 +15,21 @@ class Clipboard { } mock_cjs("clipboard", Clipboard); -const rows = mock_esm("../../static/js/rows"); -mock_esm("../../static/js/emoji_picker", { +const rows = mock_esm("../../web/src/rows"); +mock_esm("../../web/src/emoji_picker", { hide_emoji_popover: noop, }); -mock_esm("../../static/js/giphy", { +mock_esm("../../web/src/giphy", { hide_giphy_popover: noop, }); -const message_lists = mock_esm("../../static/js/message_lists", { +const message_lists = mock_esm("../../web/src/message_lists", { current: { view: { message_containers: {}, }, }, }); -mock_esm("../../static/js/stream_popover", { +mock_esm("../../web/src/stream_popover", { hide_stream_popover: noop, hide_topic_popover: noop, hide_all_messages_popover: noop, diff --git a/frontend_tests/node_tests/presence.js b/frontend_tests/node_tests/presence.js index d8eb0622b5..e525ba2468 100644 --- a/frontend_tests/node_tests/presence.js +++ b/frontend_tests/node_tests/presence.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const {page_params, user_settings} = require("../zjsunit/zpage_params"); -const reload_state = mock_esm("../../static/js/reload_state", { +const reload_state = mock_esm("../../web/src/reload_state", { is_in_progress: () => false, }); diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js index 0f2535daae..f717f22fdc 100644 --- a/frontend_tests/node_tests/reactions.js +++ b/frontend_tests/node_tests/reactions.js @@ -38,13 +38,13 @@ const sample_message = { ], }; -const channel = mock_esm("../../static/js/channel"); -const emoji_picker = mock_esm("../../static/js/emoji_picker", { +const channel = mock_esm("../../web/src/channel"); +const emoji_picker = mock_esm("../../web/src/emoji_picker", { hide_emoji_popover() {}, }); -const message_lists = mock_esm("../../static/js/message_lists"); -const message_store = mock_esm("../../static/js/message_store"); -const spectators = mock_esm("../../static/js/spectators", { +const message_lists = mock_esm("../../web/src/message_lists"); +const message_store = mock_esm("../../web/src/message_store"); +const spectators = mock_esm("../../web/src/spectators", { login_to_access() {}, }); @@ -59,7 +59,7 @@ message_lists.current = { set_global("document", "document-stub"); const emoji = zrequire("emoji"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); const people = zrequire("people"); const reactions = zrequire("reactions"); diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.js index 4b3b7b8aad..87ccdc1a73 100644 --- a/frontend_tests/node_tests/recent_senders.js +++ b/frontend_tests/node_tests/recent_senders.js @@ -23,10 +23,10 @@ function make_stream_message({stream_id, topic, sender_id}) { return message; } -mock_esm("../../static/js/message_store", { +mock_esm("../../web/src/message_store", { get: (message_id) => messages.get(message_id), }); -mock_esm("../../static/js/people", { +mock_esm("../../web/src/people", { my_current_user_id: () => 1, }); diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index 3a88d643fb..7a38579387 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -39,7 +39,7 @@ const topic10 = "topic-10"; let expected_data_to_replace_in_list_widget; -const ListWidget = mock_esm("../../static/js/list_widget", { +const ListWidget = mock_esm("../../web/src/list_widget", { modifier: noop, create(container, mapped_topic_values, opts) { @@ -75,25 +75,25 @@ const ListWidget = mock_esm("../../static/js/list_widget", { }, }); -mock_esm("../../static/js/compose_closed_ui", { +mock_esm("../../web/src/compose_closed_ui", { set_standard_text_for_reply_button: noop, update_buttons_for_recent_topics: noop, }); -mock_esm("../../static/js/hash_util", { +mock_esm("../../web/src/hash_util", { by_stream_url: test_url, by_stream_topic_url: test_url, by_conversation_and_time_url: test_url, }); -mock_esm("../../static/js/message_list_data", { +mock_esm("../../web/src/message_list_data", { MessageListData: class {}, }); -mock_esm("../../static/js/message_store", { +mock_esm("../../web/src/message_store", { get: (msg_id) => messages[msg_id - 1], }); -mock_esm("../../static/js/message_view_header", { +mock_esm("../../web/src/message_view_header", { render_title_area: noop, }); -mock_esm("../../static/js/user_topics", { +mock_esm("../../web/src/user_topics", { is_topic_muted(stream_id, topic) { if (stream_id === stream1 && topic === topic7) { return true; @@ -101,33 +101,33 @@ mock_esm("../../static/js/user_topics", { return false; }, }); -const narrow = mock_esm("../../static/js/narrow", { +const narrow = mock_esm("../../web/src/narrow", { update_narrow_title: noop, hide_mark_as_read_turned_off_banner: noop, handle_middle_pane_transition: noop, has_shown_message_list_view: true, }); -mock_esm("../../static/js/pm_list", { +mock_esm("../../web/src/pm_list", { update_private_messages: noop, handle_narrow_deactivated: noop, }); -mock_esm("../../static/js/recent_senders", { +mock_esm("../../web/src/recent_senders", { get_topic_recent_senders: () => [2, 1], }); -mock_esm("../../static/js/stream_data", { +mock_esm("../../web/src/stream_data", { is_muted: () => // We only test via muted topics for now. // TODO: Make muted streams and test them. false, }); -mock_esm("../../static/js/stream_list", { +mock_esm("../../web/src/stream_list", { handle_narrow_deactivated: noop, }); -mock_esm("../../static/js/timerender", { +mock_esm("../../web/src/timerender", { last_seen_status_from_date: () => "Just now", get_full_datetime: () => "date at time", }); -mock_esm("../../static/js/sub_store", { +mock_esm("../../web/src/sub_store", { get(stream) { if (stream === stream5) { // No data is available for deactivated streams @@ -142,10 +142,10 @@ mock_esm("../../static/js/sub_store", { }; }, }); -mock_esm("../../static/js/top_left_corner", { +mock_esm("../../web/src/top_left_corner", { narrow_to_recent_topics: noop, }); -mock_esm("../../static/js/unread", { +mock_esm("../../web/src/unread", { num_unread_for_topic(stream_id, topic) { if (stream_id === 1 && topic === "topic-1") { return 0; diff --git a/frontend_tests/node_tests/rendered_markdown.js b/frontend_tests/node_tests/rendered_markdown.js index f974563bb7..a9c8f49d52 100644 --- a/frontend_tests/node_tests/rendered_markdown.js +++ b/frontend_tests/node_tests/rendered_markdown.js @@ -17,7 +17,7 @@ class Clipboard { mock_cjs("clipboard", Clipboard); -const realm_playground = mock_esm("../../static/js/realm_playground"); +const realm_playground = mock_esm("../../web/src/realm_playground"); user_settings.emojiset = "apple"; const rm = zrequire("rendered_markdown"); diff --git a/frontend_tests/node_tests/resolved_topic.js b/frontend_tests/node_tests/resolved_topic.js index 9627940b12..b74708d171 100644 --- a/frontend_tests/node_tests/resolved_topic.js +++ b/frontend_tests/node_tests/resolved_topic.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const resolved_topic = zrequire("../shared/js/resolved_topic"); +const resolved_topic = zrequire("../shared/src/resolved_topic"); const topic_name = "asdf"; const resolved_name = "✔ " + topic_name; diff --git a/frontend_tests/node_tests/scroll_util.js b/frontend_tests/node_tests/scroll_util.js index 95644cc6aa..b88fd5ca0b 100644 --- a/frontend_tests/node_tests/scroll_util.js +++ b/frontend_tests/node_tests/scroll_util.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -mock_esm("../../static/js/ui", { +mock_esm("../../web/src/ui", { get_scroll_element: (element) => element, }); diff --git a/frontend_tests/node_tests/search_future.js b/frontend_tests/node_tests/search_future.js index 038d2acb3a..559f6f004a 100644 --- a/frontend_tests/node_tests/search_future.js +++ b/frontend_tests/node_tests/search_future.js @@ -9,24 +9,24 @@ const {page_params} = require("../zjsunit/zpage_params"); const noop = () => {}; -const narrow = mock_esm("../../static/js/narrow"); -const narrow_state = mock_esm("../../static/js/narrow_state", { +const narrow = mock_esm("../../web/src/narrow"); +const narrow_state = mock_esm("../../web/src/narrow_state", { filter: () => false, }); -const search_suggestion = mock_esm("../../static/js/search_suggestion"); +const search_suggestion = mock_esm("../../web/src/search_suggestion"); -mock_esm("../../static/js/search_pill_widget", { +mock_esm("../../web/src/search_pill_widget", { widget: { getByElement: () => true, }, }); -mock_esm("../../static/js/ui_util", { +mock_esm("../../web/src/ui_util", { place_caret_at_end: noop, }); const search = zrequire("search"); const search_pill = zrequire("search_pill"); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); function test(label, f) { run_test(label, ({override, mock_template}) => { diff --git a/frontend_tests/node_tests/search_now.js b/frontend_tests/node_tests/search_now.js index 700da3f123..69b4fce50a 100644 --- a/frontend_tests/node_tests/search_now.js +++ b/frontend_tests/node_tests/search_now.js @@ -9,13 +9,13 @@ const {page_params} = require("../zjsunit/zpage_params"); page_params.search_pills_enabled = false; -const narrow = mock_esm("../../static/js/narrow"); -const narrow_state = mock_esm("../../static/js/narrow_state"); -const search_suggestion = mock_esm("../../static/js/search_suggestion"); +const narrow = mock_esm("../../web/src/narrow"); +const narrow_state = mock_esm("../../web/src/narrow_state"); +const search_suggestion = mock_esm("../../web/src/search_suggestion"); const Filter = {}; -mock_esm("../../static/js/filter", { +mock_esm("../../web/src/filter", { Filter, }); diff --git a/frontend_tests/node_tests/search_pill.js b/frontend_tests/node_tests/search_pill.js index a8d0583b2a..7c1a4a72da 100644 --- a/frontend_tests/node_tests/search_pill.js +++ b/frontend_tests/node_tests/search_pill.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const input_pill = mock_esm("../../static/js/input_pill"); +const input_pill = mock_esm("../../web/src/input_pill"); const search_pill = zrequire("search_pill"); diff --git a/frontend_tests/node_tests/search_suggestion_future.js b/frontend_tests/node_tests/search_suggestion_future.js index d7f1dc5efe..84fd99c395 100644 --- a/frontend_tests/node_tests/search_suggestion_future.js +++ b/frontend_tests/node_tests/search_suggestion_future.js @@ -6,8 +6,8 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const {page_params} = require("../zjsunit/zpage_params"); -const narrow_state = mock_esm("../../static/js/narrow_state"); -const stream_topic_history_util = mock_esm("../../static/js/stream_topic_history_util"); +const narrow_state = mock_esm("../../web/src/narrow_state"); +const stream_topic_history_util = mock_esm("../../web/src/stream_topic_history_util"); const huddle_data = zrequire("huddle_data"); diff --git a/frontend_tests/node_tests/search_suggestion_now.js b/frontend_tests/node_tests/search_suggestion_now.js index bdcda11338..c34d0e3e60 100644 --- a/frontend_tests/node_tests/search_suggestion_now.js +++ b/frontend_tests/node_tests/search_suggestion_now.js @@ -6,8 +6,8 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const {page_params} = require("../zjsunit/zpage_params"); -const narrow_state = mock_esm("../../static/js/narrow_state"); -const stream_topic_history_util = mock_esm("../../static/js/stream_topic_history_util"); +const narrow_state = mock_esm("../../web/src/narrow_state"); +const stream_topic_history_util = mock_esm("../../web/src/stream_topic_history_util"); const huddle_data = zrequire("huddle_data"); diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.js index 6f23b7cc0f..1e6633c76f 100644 --- a/frontend_tests/node_tests/server_events.js +++ b/frontend_tests/node_tests/server_events.js @@ -18,9 +18,9 @@ set_global("document", { }); set_global("addEventListener", noop); -const channel = mock_esm("../../static/js/channel"); -const message_lists = mock_esm("../../static/js/message_lists"); -mock_esm("../../static/js/reload_state", { +const channel = mock_esm("../../web/src/channel"); +const message_lists = mock_esm("../../web/src/message_lists"); +mock_esm("../../web/src/reload_state", { is_in_progress() { return false; }, @@ -36,19 +36,19 @@ page_params.test_suite = false; // we also directly write to pointer set_global("pointer", {}); -mock_esm("../../static/js/ui_report", { +mock_esm("../../web/src/ui_report", { hide_error() { return false; }, }); -mock_esm("../../static/js/stream_events", { +mock_esm("../../web/src/stream_events", { update_property() { throw new Error("subs update error"); }, }); -const message_events = mock_esm("../../static/js/message_events", { +const message_events = mock_esm("../../web/src/message_events", { insert_new_messages() { throw new Error("insert error"); }, diff --git a/frontend_tests/node_tests/settings_emoji.js b/frontend_tests/node_tests/settings_emoji.js index 387ecc4b77..1656bbceb6 100644 --- a/frontend_tests/node_tests/settings_emoji.js +++ b/frontend_tests/node_tests/settings_emoji.js @@ -6,7 +6,7 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const upload_widget = mock_esm("../../static/js/upload_widget"); +const upload_widget = mock_esm("../../web/src/upload_widget"); const settings_emoji = zrequire("settings_emoji"); run_test("add_custom_emoji_post_render", () => { diff --git a/frontend_tests/node_tests/settings_muted_topics.js b/frontend_tests/node_tests/settings_muted_topics.js index 529819d8fb..87a21c33dd 100644 --- a/frontend_tests/node_tests/settings_muted_topics.js +++ b/frontend_tests/node_tests/settings_muted_topics.js @@ -6,8 +6,8 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const list_widget = mock_esm("../../static/js/list_widget"); -const muted_topics_ui = mock_esm("../../static/js/muted_topics_ui"); +const list_widget = mock_esm("../../web/src/list_widget"); +const muted_topics_ui = mock_esm("../../web/src/muted_topics_ui"); const settings_muted_topics = zrequire("settings_muted_topics"); const stream_data = zrequire("stream_data"); diff --git a/frontend_tests/node_tests/settings_muted_users.js b/frontend_tests/node_tests/settings_muted_users.js index 16607e324e..71e3fdc617 100644 --- a/frontend_tests/node_tests/settings_muted_users.js +++ b/frontend_tests/node_tests/settings_muted_users.js @@ -6,8 +6,8 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const list_widget = mock_esm("../../static/js/list_widget"); -const muted_users_ui = mock_esm("../../static/js/muted_users_ui"); +const list_widget = mock_esm("../../web/src/list_widget"); +const muted_users_ui = mock_esm("../../web/src/muted_users_ui"); const settings_muted_users = zrequire("settings_muted_users"); const muted_users = zrequire("muted_users"); diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index c1c80c7ab5..67cec70ea8 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -11,15 +11,15 @@ const {page_params} = require("../zjsunit/zpage_params"); const noop = () => {}; -const realm_icon = mock_esm("../../static/js/realm_icon"); +const realm_icon = mock_esm("../../web/src/realm_icon"); -const channel = mock_esm("../../static/js/channel"); +const channel = mock_esm("../../web/src/channel"); -mock_esm("../../static/js/csrf", {csrf_token: "token-stub"}); -mock_esm("../../static/js/list_widget", { +mock_esm("../../web/src/csrf", {csrf_token: "token-stub"}); +mock_esm("../../web/src/list_widget", { create: () => ({init: noop}), }); -mock_esm("../../static/js/loading", { +mock_esm("../../web/src/loading", { make_indicator: noop, destroy_indicator: noop, }); diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js index dacf009d60..38a2a95ee4 100644 --- a/frontend_tests/node_tests/settings_profile_fields.js +++ b/frontend_tests/node_tests/settings_profile_fields.js @@ -7,7 +7,7 @@ const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); const {page_params} = require("../zjsunit/zpage_params"); -const loading = mock_esm("../../static/js/loading"); +const loading = mock_esm("../../web/src/loading"); const SHORT_TEXT_ID = 1; diff --git a/frontend_tests/node_tests/settings_realm_domains.js b/frontend_tests/node_tests/settings_realm_domains.js index fe2ede6523..bf217e88b5 100644 --- a/frontend_tests/node_tests/settings_realm_domains.js +++ b/frontend_tests/node_tests/settings_realm_domains.js @@ -6,9 +6,9 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -const channel = mock_esm("../../static/js/channel"); +const channel = mock_esm("../../web/src/channel"); const noop = () => {}; -mock_esm("../../static/js/ui_report", { +mock_esm("../../web/src/ui_report", { success(msg, elem) { elem.val(msg); }, diff --git a/frontend_tests/node_tests/settings_user_groups_legacy.js b/frontend_tests/node_tests/settings_user_groups_legacy.js index 8d20068341..a7724b9ac0 100644 --- a/frontend_tests/node_tests/settings_user_groups_legacy.js +++ b/frontend_tests/node_tests/settings_user_groups_legacy.js @@ -17,17 +17,17 @@ const pills = { let create_item_handler; -const channel = mock_esm("../../static/js/channel"); -const confirm_dialog = mock_esm("../../static/js/confirm_dialog"); -const dialog_widget = mock_esm("../../static/js/dialog_widget"); -const input_pill = mock_esm("../../static/js/input_pill"); -const typeahead_helper = mock_esm("../../static/js/typeahead_helper"); -const user_groups = mock_esm("../../static/js/user_groups", { +const channel = mock_esm("../../web/src/channel"); +const confirm_dialog = mock_esm("../../web/src/confirm_dialog"); +const dialog_widget = mock_esm("../../web/src/dialog_widget"); +const input_pill = mock_esm("../../web/src/input_pill"); +const typeahead_helper = mock_esm("../../web/src/typeahead_helper"); +const user_groups = mock_esm("../../web/src/user_groups", { get_user_group_from_id: noop, remove: noop, add: noop, }); -const ui_report = mock_esm("../../static/js/ui_report"); +const ui_report = mock_esm("../../web/src/ui_report"); const people = zrequire("people"); const settings_data = zrequire("settings_data"); diff --git a/frontend_tests/node_tests/starred_messages.js b/frontend_tests/node_tests/starred_messages.js index 57e4aea688..4924f53fbe 100644 --- a/frontend_tests/node_tests/starred_messages.js +++ b/frontend_tests/node_tests/starred_messages.js @@ -7,10 +7,10 @@ const {make_stub} = require("../zjsunit/stub"); const {run_test} = require("../zjsunit/test"); const {page_params, user_settings} = require("../zjsunit/zpage_params"); -const top_left_corner = mock_esm("../../static/js/top_left_corner", { +const top_left_corner = mock_esm("../../web/src/top_left_corner", { update_starred_count() {}, }); -const stream_popover = mock_esm("../../static/js/stream_popover", { +const stream_popover = mock_esm("../../web/src/stream_popover", { hide_topic_popover() {}, hide_starred_messages_popover() {}, }); diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js index 45904784df..1b5ee318bd 100644 --- a/frontend_tests/node_tests/stream_edit.js +++ b/frontend_tests/node_tests/stream_edit.js @@ -2,7 +2,7 @@ const {strict: assert} = require("assert"); -const {get_stream_email_address} = require("../../static/js/stream_edit"); +const {get_stream_email_address} = require("../../web/src/stream_edit"); const {run_test} = require("../zjsunit/test"); run_test("get_stream_email_address", () => { diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js index a0660c7a7d..da9bbb406a 100644 --- a/frontend_tests/node_tests/stream_events.js +++ b/frontend_tests/node_tests/stream_events.js @@ -10,31 +10,31 @@ const $ = require("../zjsunit/zjquery"); const noop = () => {}; -const color_data = mock_esm("../../static/js/color_data"); -const stream_color = mock_esm("../../static/js/stream_color"); -const stream_list = mock_esm("../../static/js/stream_list"); -const stream_muting = mock_esm("../../static/js/stream_muting"); -const stream_settings_ui = mock_esm("../../static/js/stream_settings_ui", { +const color_data = mock_esm("../../web/src/color_data"); +const stream_color = mock_esm("../../web/src/stream_color"); +const stream_list = mock_esm("../../web/src/stream_list"); +const stream_muting = mock_esm("../../web/src/stream_muting"); +const stream_settings_ui = mock_esm("../../web/src/stream_settings_ui", { update_settings_for_subscribed: noop, }); -const unread_ui = mock_esm("../../static/js/unread_ui"); +const unread_ui = mock_esm("../../web/src/unread_ui"); -const message_lists = mock_esm("../../static/js/message_lists", { +const message_lists = mock_esm("../../web/src/message_lists", { current: {}, }); -const message_view_header = mock_esm("../../static/js/message_view_header", { +const message_view_header = mock_esm("../../web/src/message_view_header", { maybe_rerender_title_area_for_stream() {}, }); -mock_esm("../../static/js/recent_topics_ui", { +mock_esm("../../web/src/recent_topics_ui", { complete_rerender() {}, }); -mock_esm("../../static/js/settings_notifications", { +mock_esm("../../web/src/settings_notifications", { update_page() {}, }); -mock_esm("../../static/js/overlays", {streams_open: () => true}); +mock_esm("../../web/src/overlays", {streams_open: () => true}); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const narrow_state = zrequire("narrow_state"); const peer_data = zrequire("peer_data"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index 5395418616..efee886172 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -17,23 +17,23 @@ let num_unread_for_stream; let stream_has_any_unread_mentions; const noop = () => {}; -mock_esm("../../static/js/narrow_state", { +mock_esm("../../web/src/narrow_state", { active: () => false, }); -const topic_list = mock_esm("../../static/js/topic_list"); -mock_esm("../../static/js/keydown_util", { +const topic_list = mock_esm("../../web/src/topic_list"); +mock_esm("../../web/src/keydown_util", { handle: noop, }); -const scroll_util = mock_esm("../../static/js/scroll_util", { +const scroll_util = mock_esm("../../web/src/scroll_util", { scroll_element_into_container() {}, }); -mock_esm("../../static/js/ui", {get_scroll_element: ($element) => $element}); -mock_esm("../../static/js/unread", { +mock_esm("../../web/src/ui", {get_scroll_element: ($element) => $element}); +mock_esm("../../web/src/unread", { num_unread_for_stream: () => num_unread_for_stream, stream_has_any_unread_mentions: () => stream_has_any_unread_mentions, }); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const stream_sort = zrequire("stream_sort"); const stream_data = zrequire("stream_data"); const stream_list = zrequire("stream_list"); diff --git a/frontend_tests/node_tests/stream_search.js b/frontend_tests/node_tests/stream_search.js index 6a8744d903..9a17fef6af 100644 --- a/frontend_tests/node_tests/stream_search.js +++ b/frontend_tests/node_tests/stream_search.js @@ -11,14 +11,14 @@ const $ = require("../zjsunit/zjquery"); const noop = () => {}; -mock_esm("../../static/js/resize", { +mock_esm("../../web/src/resize", { resize_page_components: noop, resize_stream_filters_container: noop, }); -const popovers = mock_esm("../../static/js/popovers"); -const stream_popover = mock_esm("../../static/js/stream_popover"); +const popovers = mock_esm("../../web/src/popovers"); +const stream_popover = mock_esm("../../web/src/stream_popover"); const stream_list = zrequire("stream_list"); diff --git a/frontend_tests/node_tests/stream_settings_ui.js b/frontend_tests/node_tests/stream_settings_ui.js index f6f55553bf..5da8cbabb9 100644 --- a/frontend_tests/node_tests/stream_settings_ui.js +++ b/frontend_tests/node_tests/stream_settings_ui.js @@ -8,11 +8,11 @@ const $ = require("../zjsunit/zjquery"); const denmark_stream_id = 101; -const ui = mock_esm("../../static/js/ui", { +const ui = mock_esm("../../web/src/ui", { get_content_element: ($element) => $element, }); -mock_esm("../../static/js/hash_util", { +mock_esm("../../web/src/hash_util", { by_stream_url() {}, get_current_hash_section: () => denmark_stream_id, }); diff --git a/frontend_tests/node_tests/stream_topic_history.js b/frontend_tests/node_tests/stream_topic_history.js index a8f7e3438a..324bb9a206 100644 --- a/frontend_tests/node_tests/stream_topic_history.js +++ b/frontend_tests/node_tests/stream_topic_history.js @@ -5,8 +5,8 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const channel = mock_esm("../../static/js/channel"); -const message_util = mock_esm("../../static/js/message_util"); +const channel = mock_esm("../../web/src/channel"); +const message_util = mock_esm("../../web/src/message_util"); const all_messages_data = zrequire("all_messages_data"); const unread = zrequire("unread"); diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.js index d17e9df75a..25d1b30fcb 100644 --- a/frontend_tests/node_tests/submessage.js +++ b/frontend_tests/node_tests/submessage.js @@ -6,9 +6,9 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); -const channel = mock_esm("../../static/js/channel"); -const message_store = mock_esm("../../static/js/message_store"); -const widgetize = mock_esm("../../static/js/widgetize"); +const channel = mock_esm("../../web/src/channel"); +const message_store = mock_esm("../../web/src/message_store"); +const widgetize = mock_esm("../../web/src/widgetize"); const submessage = zrequire("submessage"); diff --git a/frontend_tests/node_tests/support.js b/frontend_tests/node_tests/support.js index 3866a9c276..da1384fc4d 100644 --- a/frontend_tests/node_tests/support.js +++ b/frontend_tests/node_tests/support.js @@ -13,7 +13,7 @@ const template = fs.readFileSync("templates/analytics/realm_details.html", "utf8 const dom = new JSDOM(template, {pretendToBeVisual: true}); const document = dom.window.document; -zrequire("../js/analytics/support"); +zrequire("../src/analytics/support"); run_test("scrub_realm", () => { $.get_initialize_function()(); diff --git a/frontend_tests/node_tests/top_left_corner.js b/frontend_tests/node_tests/top_left_corner.js index a27c856aae..c36fa6f35d 100644 --- a/frontend_tests/node_tests/top_left_corner.js +++ b/frontend_tests/node_tests/top_left_corner.js @@ -6,11 +6,11 @@ const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const $ = require("../zjsunit/zjquery"); -mock_esm("../../static/js/resize", { +mock_esm("../../web/src/resize", { resize_stream_filters_container() {}, }); -const {Filter} = zrequire("../js/filter"); +const {Filter} = zrequire("../src/filter"); const top_left_corner = zrequire("top_left_corner"); run_test("narrowing", () => { diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js index 9d9a062868..fdb3387024 100644 --- a/frontend_tests/node_tests/topic_generator.js +++ b/frontend_tests/node_tests/topic_generator.js @@ -5,10 +5,10 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const user_topics = mock_esm("../../static/js/user_topics"); -const stream_data = mock_esm("../../static/js/stream_data"); -const stream_topic_history = mock_esm("../../static/js/stream_topic_history"); -const unread = mock_esm("../../static/js/unread"); +const user_topics = mock_esm("../../web/src/user_topics"); +const stream_data = mock_esm("../../web/src/stream_data"); +const stream_topic_history = mock_esm("../../web/src/stream_topic_history"); +const unread = mock_esm("../../web/src/unread"); const pm_conversations = zrequire("pm_conversations"); pm_conversations.recent = {}; diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.js index ffb47d7d48..80a807ea03 100644 --- a/frontend_tests/node_tests/topic_list_data.js +++ b/frontend_tests/node_tests/topic_list_data.js @@ -7,7 +7,7 @@ const _ = require("lodash"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -mock_esm("../../static/js/message_store", { +mock_esm("../../web/src/message_store", { get() { return { stream_id: 556, @@ -15,16 +15,16 @@ mock_esm("../../static/js/message_store", { }; }, }); -const user_topics = mock_esm("../../static/js/user_topics", { +const user_topics = mock_esm("../../web/src/user_topics", { is_topic_muted() { return false; }, }); -const narrow_state = mock_esm("../../static/js/narrow_state", { +const narrow_state = mock_esm("../../web/src/narrow_state", { topic() {}, }); -const topic_list = mock_esm("../../static/js/topic_list", { +const topic_list = mock_esm("../../web/src/topic_list", { get_topic_search_term() {}, }); diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index c1ad7aef72..0d6c71a861 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -9,10 +9,10 @@ const {page_params} = require("../zjsunit/zpage_params"); const noop = () => {}; -const channel = mock_esm("../../static/js/channel"); -const reload = mock_esm("../../static/js/reload"); -const reload_state = mock_esm("../../static/js/reload_state"); -const sent_messages = mock_esm("../../static/js/sent_messages", { +const channel = mock_esm("../../web/src/channel"); +const reload = mock_esm("../../web/src/reload"); +const reload_state = mock_esm("../../web/src/reload_state"); +const sent_messages = mock_esm("../../web/src/sent_messages", { start_tracking_message: noop, report_server_ack: noop, }); diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js index bfd3fbb20d..6cce0a631a 100644 --- a/frontend_tests/node_tests/typeahead.js +++ b/frontend_tests/node_tests/typeahead.js @@ -5,7 +5,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const typeahead = zrequire("../shared/js/typeahead"); +const typeahead = zrequire("../shared/src/typeahead"); const unicode_emojis = [ ["1f43c", "panda_face"], diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index 1e235818a0..9996f36c4d 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -6,7 +6,7 @@ const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const {page_params, user_settings} = require("../zjsunit/zpage_params"); -const stream_topic_history = mock_esm("../../static/js/stream_topic_history"); +const stream_topic_history = mock_esm("../../web/src/stream_topic_history"); const settings_config = zrequire("settings_config"); const pm_conversations = zrequire("pm_conversations"); diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js index 5526deed0e..a2e2453342 100644 --- a/frontend_tests/node_tests/typing_status.js +++ b/frontend_tests/node_tests/typing_status.js @@ -5,10 +5,10 @@ const {strict: assert} = require("assert"); const {mock_esm, set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const compose_pm_pill = mock_esm("../../static/js/compose_pm_pill"); +const compose_pm_pill = mock_esm("../../web/src/compose_pm_pill"); const typing = zrequire("typing"); -const typing_status = zrequire("../shared/js/typing_status"); +const typing_status = zrequire("../shared/src/typing_status"); function make_time(secs) { // make times semi-realistic diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.js index 3aeb39ecf4..141579d097 100644 --- a/frontend_tests/node_tests/upgrade.js +++ b/frontend_tests/node_tests/upgrade.js @@ -16,8 +16,8 @@ const dom = new JSDOM(template, {pretendToBeVisual: true}); const document = dom.window.document; const location = set_global("location", {}); -const helpers = zrequire("../js/billing/helpers"); -zrequire("../js/billing/upgrade"); +const helpers = zrequire("../src/billing/helpers"); +zrequire("../src/billing/upgrade"); run_test("initialize", ({override_rewire}) => { page_params.annual_price = 8000; diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index abe93c1aef..f720e6e779 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -19,8 +19,8 @@ mock_esm("@uppy/core", { }); mock_esm("@uppy/xhr-upload", {default: class XHRUpload {}}); -const compose_actions = mock_esm("../../static/js/compose_actions"); -mock_esm("../../static/js/csrf", {csrf_token: "csrf_token"}); +const compose_actions = mock_esm("../../web/src/compose_actions"); +mock_esm("../../web/src/csrf", {csrf_token: "csrf_token"}); const compose_ui = zrequire("compose_ui"); const upload = zrequire("upload"); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index b50020ad29..2a29c78426 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -7,41 +7,41 @@ const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); const {page_params} = require("../zjsunit/zpage_params"); -const message_live_update = mock_esm("../../static/js/message_live_update"); -const settings_account = mock_esm("../../static/js/settings_account", { +const message_live_update = mock_esm("../../web/src/message_live_update"); +const settings_account = mock_esm("../../web/src/settings_account", { update_email() {}, update_full_name() {}, update_account_settings_display() {}, }); -mock_esm("../../static/js/activity", { +mock_esm("../../web/src/activity", { redraw() {}, }); -mock_esm("../../static/js/compose", { +mock_esm("../../web/src/compose", { update_email() {}, }); -mock_esm("../../static/js/narrow_state", { +mock_esm("../../web/src/narrow_state", { update_email() {}, }); -mock_esm("../../static/js/pm_list", { +mock_esm("../../web/src/pm_list", { update_private_messages() {}, }); -mock_esm("../../static/js/settings_linkifiers", { +mock_esm("../../web/src/settings_linkifiers", { maybe_disable_widgets() {}, }); -mock_esm("../../static/js/settings_org", { +mock_esm("../../web/src/settings_org", { maybe_disable_widgets() {}, }); -mock_esm("../../static/js/settings_profile_fields", { +mock_esm("../../web/src/settings_profile_fields", { maybe_disable_widgets() {}, }); -mock_esm("../../static/js/settings_realm_user_settings_defaults", { +mock_esm("../../web/src/settings_realm_user_settings_defaults", { maybe_disable_widgets() {}, }); -mock_esm("../../static/js/settings_streams", { +mock_esm("../../web/src/settings_streams", { maybe_disable_widgets() {}, }); -mock_esm("../../static/js/settings_users", { +mock_esm("../../web/src/settings_users", { update_user_data() {}, }); diff --git a/frontend_tests/node_tests/user_search.js b/frontend_tests/node_tests/user_search.js index 7801cb1295..cdee912782 100644 --- a/frontend_tests/node_tests/user_search.js +++ b/frontend_tests/node_tests/user_search.js @@ -21,14 +21,14 @@ const fake_buddy_list = { next_key() {}, }; -mock_esm("../../static/js/buddy_list", { +mock_esm("../../web/src/buddy_list", { buddy_list: fake_buddy_list, }); -const popovers = mock_esm("../../static/js/popovers"); -const presence = mock_esm("../../static/js/presence"); -const stream_popover = mock_esm("../../static/js/stream_popover"); -const resize = mock_esm("../../static/js/resize"); +const popovers = mock_esm("../../web/src/popovers"); +const presence = mock_esm("../../web/src/presence"); +const stream_popover = mock_esm("../../web/src/stream_popover"); +const resize = mock_esm("../../web/src/resize"); set_global("document", _document); diff --git a/frontend_tests/node_tests/user_status.js b/frontend_tests/node_tests/user_status.js index ea7fd1b378..b1af8c6d09 100644 --- a/frontend_tests/node_tests/user_status.js +++ b/frontend_tests/node_tests/user_status.js @@ -5,10 +5,10 @@ const {strict: assert} = require("assert"); const {mock_esm, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); -const channel = mock_esm("../../static/js/channel"); +const channel = mock_esm("../../web/src/channel"); const user_status = zrequire("user_status"); -const emoji_codes = zrequire("../generated/emoji/emoji_codes.json"); +const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json"); const emoji = zrequire("emoji"); const emoji_params = { diff --git a/frontend_tests/node_tests/user_topics.js b/frontend_tests/node_tests/user_topics.js index 33145dd94f..b21cb97f84 100644 --- a/frontend_tests/node_tests/user_topics.js +++ b/frontend_tests/node_tests/user_topics.js @@ -2,7 +2,7 @@ const {strict: assert} = require("assert"); -const {visibility_policy} = require("../../static/js/user_topics"); +const {visibility_policy} = require("../../web/src/user_topics"); const {zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const blueslip = require("../zjsunit/zblueslip"); diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js index f4c91b9660..814bee417d 100644 --- a/frontend_tests/node_tests/widgetize.js +++ b/frontend_tests/node_tests/widgetize.js @@ -54,9 +54,9 @@ const fake_poll_widget = { }, }; -const message_lists = mock_esm("../../static/js/message_lists", {current: {}}); -const narrow_state = mock_esm("../../static/js/narrow_state"); -mock_esm("../../static/js/poll_widget", fake_poll_widget); +const message_lists = mock_esm("../../web/src/message_lists", {current: {}}); +const narrow_state = mock_esm("../../web/src/narrow_state"); +mock_esm("../../web/src/poll_widget", fake_poll_widget); set_global("document", "document-stub"); diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index 3da14f055f..788e0e915c 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -27,9 +27,9 @@ global.navigator = { require("@babel/register")({ extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"], only: [ - new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../static/js") + path.sep)), + new RegExp("^" + _.escapeRegExp(path.resolve(__dirname, "../../web/src") + path.sep)), new RegExp( - "^" + _.escapeRegExp(path.resolve(__dirname, "../../static/shared/js") + path.sep), + "^" + _.escapeRegExp(path.resolve(__dirname, "../../web/shared/src") + path.sep), ), ], plugins: [ @@ -90,7 +90,7 @@ function short_tb(tb) { return lines.splice(0, i + 1).join("\n") + "\n(...)\n"; } -require("../../static/js/templates"); // register Zulip extensions +require("../../web/src/templates"); // register Zulip extensions async function run_one_module(file) { zjquery.clear_initialize_function(); @@ -121,16 +121,16 @@ test.set_verbose(files.length === 1); _.debounce = immediate; zpage_params.reset(); - namespace.mock_esm("../../static/js/blueslip", blueslip); - require("../../static/js/blueslip"); - namespace.mock_esm("../../static/js/i18n", stub_i18n); - require("../../static/js/i18n"); - namespace.mock_esm("../../static/js/page_params", zpage_params); - require("../../static/js/page_params"); - namespace.mock_esm("../../static/js/user_settings", zpage_params); - require("../../static/js/user_settings"); - namespace.mock_esm("../../static/js/realm_user_settings_defaults", zpage_params); - require("../../static/js/realm_user_settings_defaults"); + namespace.mock_esm("../../web/src/blueslip", blueslip); + require("../../web/src/blueslip"); + namespace.mock_esm("../../web/src/i18n", stub_i18n); + require("../../web/src/i18n"); + namespace.mock_esm("../../web/src/page_params", zpage_params); + require("../../web/src/page_params"); + namespace.mock_esm("../../web/src/user_settings", zpage_params); + require("../../web/src/user_settings"); + namespace.mock_esm("../../web/src/realm_user_settings_defaults", zpage_params); + require("../../web/src/realm_user_settings_defaults"); await run_one_module(file); diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js index 82e83a3b03..bde3369a54 100644 --- a/frontend_tests/zjsunit/namespace.js +++ b/frontend_tests/zjsunit/namespace.js @@ -23,7 +23,7 @@ const real_jquery_path = require.resolve("../zjsunit/real_jquery.js"); let in_mid_render = false; let jquery_function; -const template_path = "/static/templates/"; +const template_path = "/web/templates/"; /* istanbul ignore next */ function need_to_mock_template_error(filename) { @@ -268,10 +268,10 @@ exports.zrequire = function (short_fn) { `, ); - return require(`../../static/js/${short_fn}`); + return require(`../../web/src/${short_fn}`); }; -const staticPath = path.resolve(__dirname, "../../static") + path.sep; +const webPath = path.resolve(__dirname, "../../web") + path.sep; exports.complain_about_unused_mocks = function () { for (const filename of module_mocks.keys()) { @@ -301,7 +301,7 @@ exports.finish = function () { used_module_mocks.clear(); for (const path of Object.keys(require.cache)) { - if (path.startsWith(staticPath)) { + if (path.startsWith(webPath)) { delete require.cache[path]; } } diff --git a/postcss.config.js b/postcss.config.js index d880538efd..053437b30b 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -2,7 +2,7 @@ const path = require("path"); -const {media_breakpoints} = require("./static/js/css_variables"); +const {media_breakpoints} = require("./web/src/css_variables"); module.exports = ({file}) => ({ plugins: [ diff --git a/scripts/lib/zulip_tools.py b/scripts/lib/zulip_tools.py index 26b668a6d7..a2a01eae00 100755 --- a/scripts/lib/zulip_tools.py +++ b/scripts/lib/zulip_tools.py @@ -348,7 +348,7 @@ def generate_sha1sum_emoji(zulip_path: str) -> str: sha = hashlib.sha1() filenames = [ - "static/assets/zulip-emoji/zulip.png", + "web/images/zulip-emoji/zulip.png", "tools/setup/emoji/emoji_map.json", "tools/setup/emoji/build_emoji", "tools/setup/emoji/emoji_setup_utils.py", diff --git a/static/.gitignore b/static/.gitignore index cb4096fb00..ff46c39f49 100644 --- a/static/.gitignore +++ b/static/.gitignore @@ -7,10 +7,3 @@ /generated/bots/ # From emoji /generated/emoji -/generated/emoji-styles -# From passing pygments data to the frontend -/generated/pygments_data.json -# From passing time zone data to the frontend -/generated/timezones.json -# Legacy emoji data directory -/third/emoji-data diff --git a/static/assets/README b/static/assets/README deleted file mode 100644 index 7df1ad329b..0000000000 --- a/static/assets/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains e.g. the editable originals for image files. - -The exported files we serve are checked in under static/. diff --git a/tools/check-templates b/tools/check-templates index 41c3633242..b97db2a8b1 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -25,9 +25,9 @@ EXCLUDED_FILES = [ # Our parser doesn't handle the way its conditionals are layered "templates/zerver/emails/missed_message.source.html", # Previously unchecked and our parser doesn't like its indentation - "static/assets/icons/template.hbs", + "web/images/icons/template.hbs", # Template checker recommends very hard to read indentation. - "static/templates/bookend.hbs", + "web/templates/bookend.hbs", # The parser does not like the indentation of custom ReadTheDocs templates "docs/_templates/layout.html", ] diff --git a/tools/find-unused-css b/tools/find-unused-css index d5e90e1c6c..c0dc7b17aa 100755 --- a/tools/find-unused-css +++ b/tools/find-unused-css @@ -1,8 +1,8 @@ #!/usr/bin/env bash # Hackish tool for attempting to find unused IDs / classes in our CSS -for n in $(perl -lne 'print $1 while /[#.]([a-zA-Z0-9_-]+)/g' static/styles/zulip.css | sort -u); do - if [ "$(git grep "$n" | grep -cv '^static/styles/zulip.css')" -eq 0 ]; then +for n in $(perl -lne 'print $1 while /[#.]([a-zA-Z0-9_-]+)/g' web/styles/zulip.css | sort -u); do + if [ "$(git grep "$n" | grep -cv '^web/styles/zulip.css')" -eq 0 ]; then echo "$n" fi done diff --git a/tools/lib/provision_inner.py b/tools/lib/provision_inner.py index acc1856ff0..e708e8e190 100755 --- a/tools/lib/provision_inner.py +++ b/tools/lib/provision_inner.py @@ -147,7 +147,7 @@ def setup_bash_profile() -> None: def need_to_run_build_pygments_data() -> bool: - if not os.path.exists("static/generated/pygments_data.json"): + if not os.path.exists("web/generated/pygments_data.json"): return True return is_digest_obsolete( @@ -158,7 +158,7 @@ def need_to_run_build_pygments_data() -> bool: def need_to_run_build_timezone_data() -> bool: - if not os.path.exists("static/generated/timezones.json"): + if not os.path.exists("web/generated/timezones.json"): return True return is_digest_obsolete( diff --git a/tools/linter_lib/custom_check.py b/tools/linter_lib/custom_check.py index 36b4f0dbf6..e0888c4661 100644 --- a/tools/linter_lib/custom_check.py +++ b/tools/linter_lib/custom_check.py @@ -116,7 +116,7 @@ js_rules = RuleList( rules=[ { "pattern": "subject|SUBJECT", - "exclude": {"static/js/types.ts", "static/js/util.ts", "frontend_tests/"}, + "exclude": {"web/src/types.ts", "web/src/util.ts", "frontend_tests/"}, "exclude_pattern": "emails", "description": "avoid subject in JS code", "good_lines": ["topic_name"], @@ -135,10 +135,10 @@ js_rules = RuleList( "pattern": "[.]html[(]", "exclude_pattern": r"""\.html\(("|'|render_|html|message\.content|util\.clean_user_content_links|rendered_|$|\)|error_html|widget_elem|\$error|\$\("

"\))""", "exclude": { - "static/js/portico", - "static/js/lightbox.js", - "static/js/ui_report.ts", - "static/js/dialog_widget.js", + "web/src/portico", + "web/src/lightbox.js", + "web/src/ui_report.ts", + "web/src/dialog_widget.js", "frontend_tests/", }, "description": "Setting HTML content with jQuery .html() can lead to XSS security bugs. Consider .text() or using rendered_foo as a variable name if content comes from Handlebars and thus is already sanitized.", @@ -190,12 +190,12 @@ js_rules = RuleList( "description": "Use channel module for AJAX calls", "exclude": { # Internal modules can do direct network calls - "static/js/blueslip.ts", - "static/js/channel.js", + "web/src/blueslip.ts", + "web/src/channel.js", # External modules that don't include channel.js - "static/js/stats/", - "static/js/portico/", - "static/js/billing/", + "web/src/stats/", + "web/src/portico/", + "web/src/billing/", }, "good_lines": ["channel.get(...)"], "bad_lines": ["$.get()", "$.post()", "$.ajax()"], @@ -547,7 +547,7 @@ html_rules: List["Rule"] = [ "templates/analytics/support.html", # We have URL prefix and Pygments language name as placeholders # in the below template which we don't want to be translatable. - "static/templates/settings/playground_settings_admin.hbs", + "web/templates/settings/playground_settings_admin.hbs", }, "good_lines": [ '' @@ -624,7 +624,7 @@ html_rules: List["Rule"] = [ "exclude_line": { ( # Emoji should not be tagged for translation. - "static/templates/keyboard_shortcuts.hbs", + "web/templates/keyboard_shortcuts.hbs", ':thumbs_up: tags here; put JavaScript in static/js instead.", + "description": "Do not use inline