Commit Graph

50975 Commits

Author SHA1 Message Date
David Taylor dd9000a7cd
DEV: Enable ember-cli-deprecation-workflow unconditionally (#23502)
By default this is linked to the `tests` boolean, which we disabled for Embroider builds in 96674859. We want deprecation-workflow features to be available in production builds, so let's enable it unconditionally.
2023-09-11 10:35:53 +01:00
Jarek Radosz d393fdca31
DEV: Fix random typos (#23497) 2023-09-11 11:33:08 +02:00
Jarek Radosz 381f749f60
DEV: Remove unused files (#23498) 2023-09-11 11:32:54 +02:00
Jarek Radosz 7b7a59b576
DEV: Use `import x` rather than `import { default as x }` (#23496) 2023-09-11 11:32:36 +02:00
David Taylor d7bb8f68d6
DEV: Remove unused pageobject from scroll_manager_service_spec (#23501) 2023-09-11 10:28:25 +01:00
David Battersby e771382c1c
DEV: active record validations for maxlength on text columns (#23499)
Introduce max length on text columns for description and slug fields within chat.

At a later date we will probably want to convert these text columns to string/varchar through a migration, but for now this change introduces a limit within the active record model.
2023-09-11 17:05:02 +08:00
David Taylor b07445ced8
DEV: Disable Webpack parallelization for low-memory environments (#23487)
This reduces memory usage for Embroider-based builds on low-memory servers (e.g. entry-level Digital Ocean droplets)
2023-09-11 09:32:37 +01:00
David Taylor 9667485951
DEV: Stop building test assets in production under Embroider (#23388)
Until now, we have allowed testing themes in production environments via `/theme-qunit`. This was made possible by hacking the ember-cli build so that it would create the `tests.js` bundle in production. However, this is fundamentally problematic because a number of test-specific things are still optimized out of the Ember build in production mode. It also makes asset compilation significantly slower, and makes it more difficult for us to update our build pipeline (e.g. to introduce Embroider).

This commit removes the ability to run qunit tests in production builds of the JS app when the Embdroider flag is enabled. If a production instance of Discourse exists exclusively for the development of themes (e.g. discourse.theme-creator.io) then they can add `EMBER_ENV: development` to their `app.yml` file. This will build the entire app in development mode, and has a significant performance impact. This must not be used for real production sites.

This commit also refactors many of the request specs into system specs. This means that the tests are guaranteed to have Ember assets built, and is also a better end-to-end test than simply checking for the presence of certain `<script>` tags in the HTML.
2023-09-11 09:12:37 +01:00
Kelv d28f113ce0
DEV: convert grant badge modal to component API (#23378)
* DEV: convert grant-badge to use component modal API
* DEV: add system test for grant badge modal happy path
2023-09-11 13:56:31 +08:00
dependabot[bot] 29439af375
Build(deps-dev): Bump the babel group (#23491)
Bumps the babel group in /app/assets/javascripts with 2 updates: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.22.15 to 7.22.17
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.17/packages/babel-core)

Updates `@babel/standalone` from 7.22.16 to 7.22.17
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.17/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 01:33:48 +02:00
dependabot[bot] 53a124e728
Build(deps-dev): Bump eslint in /app/assets/javascripts (#23492)
Bumps [eslint](https://github.com/eslint/eslint) from 8.48.0 to 8.49.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.48.0...v8.49.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-11 01:33:26 +02:00
David Taylor 231ea8faa2
DEV: Correctly identify Embroider chunks (#23488)
This method is used by assets:precompile to decide whether to apply `terser` to a file. Embroider chunks do not necessarily start with `chunk.`, and so they were incorrectly being re-terser'd by our assets:precompile task. This is inefficient, and also led to broken sourcemaps on some assets.
2023-09-10 10:18:43 +01:00
David Taylor e813109c18
DEV: Replace BulkTopicSelection mixin with a helper object (#23486)
Previously landed in 206969e and then reverted in 7b165c6 due to an issue with tag-show. This PR resolves that issue.
2023-09-09 14:08:02 +01:00
Jarek Radosz 8c6b1fbbc1
DEV: Move helper tests to the correct directory (#23485) 2023-09-09 14:03:13 +02:00
Isaac Janzen 7b165c6c2f
Revert "DEV: Replace BulkTopicSelection mixin with a helper object (#23268)" (#23484)
This reverts commit 206969e49d.
2023-09-09 00:26:56 +01:00
Renato Atilio abae6ecadc
UX: remove unsupported features from form template help text (#23482) 2023-09-08 15:39:27 -03:00
Isaac Janzen 198181b7f8
DEV: Convert `raw-email` modal to component-based API (#23471) 2023-09-08 13:28:23 -05:00
Isaac Janzen daf8c32d0e
FIX: Render 'In topic context' search results at the correct time (#23481) 2023-09-08 12:20:55 -05:00
Kris 22747e26fd
DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
Joffrey JAFFEUX 7bcf934765
FIX: ensures automation can send chat message (#23478)
It's been broken in 243793ec6e. Sadly it's not very practical to write cross plugins tests.
2023-09-08 16:37:05 +02:00
Bianca Nenciu 4db5310135
DEV: Remove unused topic_create_allowed_category_ids (#23463) 2023-09-08 12:03:22 +03:00
Alan Guo Xiang Tan 26dfb8a489
DEV: Remove chat related migration (#23449)
What motivated this change?

A core migration contains chat related code and this should not be the
case since chat related migration code should live in the chat plugin.

What does this change do?

This change removes the migration which was introduced to keep existing
sites on the legacy navigation menu as well as keep chat disabled when
the defaults for the `navigation_menu` and `chat_enabled` site settings
were flipped. Since this migration doesn't apply to new sites and
the migration has already been introduced for 9 months, it is safe for
us to remove it.
2023-09-08 12:41:56 +08:00
Alan Guo Xiang Tan dc76d82f24
DEV: Fix broken conditional in `docker:test` Rake task (#23477)
Broke in ef73d20832
2023-09-08 12:16:02 +08:00
Alan Guo Xiang Tan 8ce5b82aa5
DEV: Allow `CAPYBARA_REMOTE_DRIVER_URL` through webmock (#23476)
Why this change?

When using a remote capybara driver configured through the
`CAPYBARA_REMOTE_DRIVER_URL` env, webmock is thinking that is an
external request and blocking it. As such, we need to set the URL to the
allowlist for webmock.
2023-09-08 11:17:08 +08:00
Alan Guo Xiang Tan 6beed147cd
DEV: Add `CAPYBARA_SERVER_HOST` (#23475)
Why this change?

When running in a Docker container, we want to bind the Rails server
started by Capybara to 0.0.0.0 instead of localhost. This is done via
the `server_host` config for Capybara which can now be configured via
the `CAPYBARA_SERVER_HOST` env.
2023-09-08 11:16:48 +08:00
Alan Guo Xiang Tan ef73d20832
DEV: Fix `docker:test:setup` Rake task that was missing the DB (#23474)
This is a follow up to 9caba30d5c

In that commit, we were migrating the database but we didn't actually
ensure that the database was created and that plugins were updated
before the databases were migrated.
2023-09-08 10:16:23 +08:00
dependabot[bot] 0a8843a151
Build(deps): Bump google-protobuf from 3.24.2 to 3.24.3 (#23472)
Bumps [google-protobuf](https://github.com/protocolbuffers/protobuf) from 3.24.2 to 3.24.3.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/compare/v3.24.2...v3.24.3)

---
updated-dependencies:
- dependency-name: google-protobuf
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 01:18:37 +02:00
dependabot[bot] dc29136af0
Build(deps-dev): Bump the babel group (#23445)
Bumps the babel group in /app/assets/javascripts with 1 update: [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).

- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.16/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-08 01:18:25 +02:00
Kris a35842e369
UX: fix mobile timeline footer button positioning (#23470) 2023-09-07 18:26:35 -04:00
Kris 4ed0ab79f6
FIX: focus state color on `.btn[href]` (#23469) 2023-09-07 17:51:34 -04:00
David Taylor 75ce01a69b
DEV: Ensure Embroider sourcemaps are collected by Sprockets (#23468)
Names of sourcemaps are not necessarily equal to the js file names. Instead, we can check the `sourceMappingURL` comment to find the map's filename.
2023-09-07 22:20:52 +01:00
David Taylor 754cd9cd22
DEV: Enable sourcemaps in production under Embroider (#23466) 2023-09-07 19:35:39 +01:00
David Taylor 206969e49d
DEV: Replace BulkTopicSelection mixin with a helper object (#23268)
Mixins are considered deprecated by Ember, and cannot be applied to modern framework objects. Also, the coupling they introduce can make things very difficult to refactor.

This commit takes the state/logic from BulkTopicSelection and turns it into a helper object. This avoids it polluting any controllers/components its included in.

In future, the entire helper object can be passed down to child components so that they don't need to lookup controllers using the resolver. Those kinds of changes would involve changing some very heavily-overridden templates, so they are not included in this PR. It will likely be done as part of the larger refactor in https://github.com/discourse/discourse/pull/22622.
2023-09-07 19:05:41 +01:00
Isaac Janzen 72f124a5d0
DEV: Update `install-theme` modal extension points (#23444) 2023-09-07 10:28:16 -05:00
David Taylor 894307ff0e
DEV: Update asset config for embroider (#23461)
- Add data-embroider-ignore to all script tags which are not currently being compiled by embroider

- Ensure all remaining script tags are wrapped in `<discourse-chunked-script>` so that Rails will follow any renames which Embroider makes (e.g. when it adds fingerprints to filenames)
2023-09-07 16:17:22 +01:00
chapoi cde5dea74f
UX: popping animation for adding users (#23459)
* UX:  popping animation for adding users

* accessibility wrapper
2023-09-07 15:42:49 +02:00
Godfrey Chan e1373c3e84
DEV: introduce Embroider behind a flag, and start testing in CI (#23005)
Discourse core now builds and runs with Embroider! This commit adds
the Embroider-based build pipeline (`USE_EMBROIDER=1`) and start
testing it on CI.

The new pipeline uses Embroider's compat mode + webpack bundler to
build discourse code, and leave everything else (admin, wizard,
markdown-it, plugins, etc) exactly the same using the existing
Broccoli-based build as external bundles (<script> tags), passed
to the build as `extraPublicTress` (which just means they get
placed in the `/public` folder).

At runtime, these "external" bundles are glued back together with
`loader.js`. Specifically, the external bundles are compiled as
AMD modules (just as they were before) and registered with the
global `loader.js` instance. They expect their `import`s (outside
of whatever is included in the bundle) to be already available in
the `loader.js` runtime registry.

In the classic build, _every_ module gets compiled into AMD and
gets added to the `loader.js` runtime registry. In Embroider,
the goal is to do this as little as possible, to give the bundler
more flexibility to optimize modules, or omit them entirely if it
is confident that the module is unused (i.e. tree-shaking).

Even in the most compatible mode, there are cases where Embroider
is confident enough to omit modules in the runtime `loader.js`
registry (notably, "auto-imported" non-addon NPM packages). So we
have to be mindful of that an manage those dependencies ourselves,
as seen in #22703.

In the longer term, we will look into using modern features (such
as `import()`) to express these inter-dependencies.

This will only be behind a flag for a short period of time while we
perform some final testing. Within the next few weeks, we intend
to enable by default and remove the flag.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-09-07 13:15:43 +01:00
Andrei Prigorshnev 73781c8a96
FIX: Do not consider code-blocks when parsing mentions (#23280)
We have the max_mentions_per_chat_message site settings; when a user tries 
to mention more users than allowed, no one gets mentioned.

Chat messages may contain code-blocks with strings that look like mentions:

  def foo
    @bar + @baz
  end

The problem is that the parsing code considers these as real mentions and counts 
them when checking the limit. This commit fixes the problem.
2023-09-07 16:13:13 +04:00
Alan Guo Xiang Tan f165c99d77
DEV: Fix typo in `docker_test.rb` script (#23456)
Follow up to 9caba30d5c
2023-09-07 15:36:27 +08:00
Loïc Guitaut 243793ec6e
DEV: Migrate `Chat::MessageCreator` to a service (#22390)
Currently, the logic for creating a new chat message is scattered
between a controller and an “old” service.

This patch address this issue by creating a new service (using the “new”
sevice object system) encapsulating all the necessary logic.
(authorization, publishing events, etc.)
2023-09-07 08:57:29 +02:00
Alan Guo Xiang Tan 1f0a78fb82
DEV: Remove accidentally hardcoded Redis port in `docker.rake` (#23455)
Follow up to 9caba30d5c
2023-09-07 14:22:14 +08:00
Alan Guo Xiang Tan 71595647a5
DEV: Add env to configure Capybara to run against a remote chrome (#23453)
What motivated this change?

We are currently working on allowing system tests to be run within a
Docker container. While system tests are usually ran in chrome headless
mode, it is useful to also be able to run the system tests with chrome
in the non-headless mode. However, running a GUI application from within
a docker container is not usually recommended and from our research
quite difficult. As such, we want to allow running system tests against
a remote browser.

For example, one can run a `chromedriver` server on localhost and then
configure Capybara to connect to the `chromedriver` from within the
container.

What does this change do?

This change adds support for a `CAPYBARA_REMOTE_DRIVER_URL` env variable
which will switch Capybara to use the remote driver instead of the
`chrome` driver. Currently, we expect the remote driver to be a
`chromedriver` server.
2023-09-07 14:07:17 +08:00
Alan Guo Xiang Tan 9caba30d5c
DEV: Add `docker:test:setup` Rake task (#23430)
## What is the context here?

The `docker.rake` Rakefile contains Rake tasks that are meant to be run
in the `discourse/discourse_test:release` Docker image. For example, we
have the `docker:test` Rake task that makes it easier to run the test
suite for a particular Discourse commit.

Why are we introducing a `docker:test:setup` Rake task?

While we have the `docker:test` Rake task, it is very limited in the
test commands that can be executed. It is very useful for automated
testing but not very useful for running tests in the development
environment. Therefore, we are introducing a `docker:test:setup` rake
task that can be used to set up the test environment for running tests.

The envisioned example usage is something like this:

```
docker run -d --name=discourse_test --entrypoint=/sbin/boot discourse/discourse_test:release
docker exec -u discourse:discourse discourse_test ruby script/docker_test.rb --no-tests
docker exec -u discourse:discourse discourse_test bundle exec rake docker:test:setup
docker exec -u discourse:discourse discourse_test bundle exec rspec <path to file>
```
2023-09-07 13:46:23 +08:00
Ted Johansson ad58b6d604
DEV: Validate before and bumped_before options in TopicQuery (#23451) 2023-09-07 14:38:03 +10:00
Martin Brennan 93c32b9e07
DEV: Temporarily skip minio system specs (#23450)
Doing this because the same issue exists as did for chromedriver
fixed by TGX in X for minio. Need time to add support for parallel
tests in the minio_runner gem so this doesn't happen:

```
Failure/Error:
   File.open(dest, "wb", s.stat.mode) do |f|
     IO.copy_stream(s, f)
     f.chmod(f.lstat.mode)
   end

 Errno::ETXTBSY:
   Text file busy @ rb_sysopen - /github/home/.minio_runner/minio

./lib/freedom_patches/copy_file.rb:10:in `copy_file'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner/binary_manager.rb:49:in `block in download_binary'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner/network.rb:72:in `download'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner/binary_manager.rb:48:in `download_binary'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner/binary_manager.rb:29:in `install'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner/binary_manager.rb:9:in `install'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner.rb:62:in `install_binaries'
./vendor/bundle/ruby/3.2.0/gems/minio_runner-0.1.1/lib/minio_runner.rb:50:in `start'
./spec/support/system_helpers.rb:157:in `setup_s3_system_test'
```
2023-09-07 10:38:38 +08:00
Jarek Radosz 02bd709bc3
DEV: Fix badge tests (#23442)
`badge.save(["name", "description", "badge_type_id"])` api it was testing isn't a thing anymore.

Also: replaces `assert.expect(0)` with more useful assertions
2023-09-07 09:53:37 +08:00
dependabot[bot] 4776983620
Build(deps-dev): Bump minitest from 5.19.0 to 5.20.0 (#23446)
Bumps [minitest](https://github.com/minitest/minitest) from 5.19.0 to 5.20.0.
- [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc)
- [Commits](https://github.com/minitest/minitest/compare/v5.19.0...v5.20.0)

---
updated-dependencies:
- dependency-name: minitest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 09:47:52 +08:00
dependabot[bot] 24ce586011
Build(deps-dev): Bump parallel_tests from 4.2.1 to 4.2.2 (#23447)
Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 4.2.1 to 4.2.2.
- [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md)
- [Commits](https://github.com/grosser/parallel_tests/compare/v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: parallel_tests
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-07 09:47:39 +08:00
David Taylor 31563e6b29
DEV: Reduce `psql` output when restoring db in github actions (#23391)
This output is around 30k lines long, and serves no real purpose. In the unlikely event of an error, it will still be shown.
2023-09-06 22:19:59 +01:00
Michael Brown 30528eac5c FIX: add missing translation key
This is used when browsing/filtering on all categories and new results appear.
2023-09-06 13:40:45 -04:00