Commit Graph

58452 Commits

Author SHA1 Message Date
ecbd3cc93a DEV: Fix custom homepage crawler display and override (#31841)
Fixes the custom homepage crawler output to include links to the site's
top menu.

![CleanShot 2025-03-15 at 16 27
16@2x](https://github.com/user-attachments/assets/57f25b65-a218-4811-b7d4-211e3d60e586)

This also provides a way to override that content via a plugin. Example
usage in a `plugin.rb` file:

```
register_html_builder("server:custom-homepage-crawler-view") do |c|
  "<div>override</div>"
end
```
2025-03-17 13:06:09 -04:00
08d99dc44a DEV: normalize tag text color assignment (#31860)
This reduces some duplicate color assignment to tags and rolls them up
under a common css var

```css
:root {
  --tag-text-color: var(--primary-high);
}

.extra-info-wrapper {
  --tag-text-color: var(--header_primary-high);
}
```

This also makes the tag separator color consistent with the tag color,
by setting it to `--tag-text-color`

Ultimately we have 3 tag text color states (this appeared to be
consistent across all tag styles):
* Default: primary-high
* Header: header__primary-high
* Visited topic in the topic list: primary-medium
2025-03-17 12:54:15 -04:00
c07c954809 DEV: Remove search_result_view search menu app event in favor of search_menu_opened (#31777) 2025-03-17 09:54:09 -05:00
06b7b4981f DEV: Improve color-definition stylesheet failure mode (#31858)
- Raise exception in dev/test environments
- Include a clue about the failure via a comment in production mode
2025-03-17 14:04:26 +00:00
c3c2ee2a03 UX: Improve loading state when changing admin user list (#31856)
Previously we were showing a loading spinner, but the old user list
persisted so the spinner was often off the bottom of the screen. This
commit updates the `users` list to be a getter, so it's always perfectly
in-sync with the `_results` set. That means no users will be shown while
a new list is being loaded, so the spinner is more visible.


https://meta.discourse.org/t/load-spinner-missing-from-dynamic-pages/357525/4
2025-03-17 14:03:17 +00:00
2bca748a05 Revert "DEV: remove singleton mixin (#31823)" (#31857)
This reverts commit 992bdf173ad8ad25764c0a89132bc35df4c81f12.

This change was causing issues in a [third party
plugin](https://meta.discourse.org/t/events-plugin):
https://meta.discourse.org/t/events-plugin/69776/869

```
Uncaught Error: Could not find module `discourse/mixins/singleton` imported from `discourse/plugins/discourse-events/discourse/models/provider`
    at loader.js:247:1
    at h (loader.js:258:1)
    at u.findDeps (loader.js:168:1)
    at h (loader.js:262:1)
    at u.findDeps (loader.js:168:1)
    at h (loader.js:262:1)
    at requireModule (loader.js:24:1)
    at y (app.js:170:18)
    at b (app.js:193:19)
    at app.js:156:29
    at g.start (app.js:167:1)
    at HTMLDocument.<anonymous> (start-app.js:5:7)
    at discourse-boot.js:13:12
    at discourse-boot.js:1:1
```
2025-03-17 14:43:14 +01:00
e2b3eb4c28 Build(deps-dev): Bump message-bus-client from 4.3.9 to 4.4.0 (#31843)
Bumps [message-bus-client](https://github.com/discourse/message_bus)
from 4.3.9 to 4.4.0.
-
[Changelog](https://github.com/discourse/message_bus/blob/main/CHANGELOG)
-
[Commits](https://github.com/discourse/message_bus/compare/v4.3.9...v4.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 15:05:10 +08:00
7be5b8a6a8 Build(deps): Bump nokogiri from 1.18.3 to 1.18.4 (#31844)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.3
to 1.18.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
-
[Changelog](https://github.com/sparklemotion/nokogiri/blob/v1.18.4/CHANGELOG.md)
-
[Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.3...v1.18.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 15:04:47 +08:00
327375abee FIX: Use theme screenshot names in theme fields (#31852)
Currently we allow for 2 theme screenshots to be specified,
with a lightweight spec to allow both a light and dark
version of the screenshot. However, we were not storing this
screenshot name anywhere, so we would not be able to use it
for light/dark switching.

This commit fixes that issue, and also does some general refactoring
around theme screenshots, and adds more tests.
2025-03-17 15:56:19 +10:00
d0a5fd5e21 Build(deps-dev): Bump rubocop-ast from 1.38.1 to 1.39.0 (#31847)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.38.1
to 1.39.0.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
-
[Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop-ast/compare/v1.38.1...v1.39.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 15:42:57 +11:00
097e1d7ee4 Build(deps): Bump google-protobuf from 4.30.0 to 4.30.1 (#31846)
Bumps [google-protobuf](https://github.com/protocolbuffers/protobuf)
from 4.30.0 to 4.30.1.
- [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/v4.30.0...v4.30.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 15:23:24 +11:00
6af9f415bf DEV: Skip a flaky test (#31850)
Test is flaking in CI with:

```
Failure/Error: expect(theme_translations_settings_editor.get_input_value).to have_content("Bonjour!")
  expected to find text "Bonjour!" in "Hello there!"

[Screenshot Image]: /__w/discourse/discourse/tmp/capybara/failures_r_spec_example_groups_admin_customize_themes_when_editing_theme_translations_should_allow_admin_to_edit_and_save_the_theme_translations_from_other_languages_797.png

~~~~~~~ JS LOGS ~~~~~~~
(no logs)
~~~~~ END JS LOGS ~~~~~

./spec/system/admin_customize_themes_spec.rb:158:in `block (3 levels) in <main>'
```
2025-03-17 10:47:37 +08:00
1fea45eb0f DEV: Skip flaky test (#31849)
The test has been flaking in CI with the following message:

```
Failure/Error: measurement = Benchmark.measure { example.run }

  expected: "draft"
       got: ""

  (compared using ==)

[Screenshot Image]: /__w/discourse/discourse/tmp/capybara/failures_r_spec_example_groups_chat_composer_draft_when_loading_a_channel_with_a_draft_loads_the_draft_458.png

~~~~~~~ JS LOGS ~~~~~~~
~~~~~ END JS LOGS ~~~~~

./plugins/chat/spec/system/chat_composer_draft_spec.rb:31:in `block (3 levels) in <main>'
```
2025-03-17 10:39:22 +08:00
64f1b97e0c FEATURE: Add welcome banner to core (#31516)
This is a stripped-back version of the Search Banner
component https://meta.discourse.org/t/search-banner/122939,
which will be renamed to Advanced Search Banner,
see https://github.com/discourse/discourse-search-banner/pull/84.

This welcome banner interacts with the header search.
When `search_experience` is set to `search_field`, we only
show the header search after the welcome banner scrolls
out of view, and vice-versa.

Only new sites will get this feature turned on by default,
existing sites have a migration to disable it.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2025-03-17 12:18:08 +10:00
c5e95b419b Build(deps): Bump message_bus from 4.3.9 to 4.4.0 (#31845)
Bumps [message_bus](https://github.com/discourse/message_bus) from 4.3.9
to 4.4.0.
-
[Changelog](https://github.com/discourse/message_bus/blob/main/CHANGELOG)
-
[Commits](https://github.com/discourse/message_bus/compare/v4.3.9...v4.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-17 08:25:49 +08:00
02b8aa6096 DEV: Protection for migrations that creates index concurrently take 2 (#31792)
This is a follow up to 6820622467ab3613e824f0cb6219def2a575bc1d.

This commit addresses migrations that uses `remove_index` with the
`if_exists: true` option to drop an existing index before creating an
index using the `concurrently` option.

This commit also reruns two migration which may have caused indexes to
be left in an `invalid` state.

### Reviewers Note

Plugin tests are failing due to
https://github.com/discourse/discourse-translator/pull/251
2025-03-17 08:25:30 +08:00
0ebd0a0bd5 UX: Refactor, removal, cleanup (#31839) 2025-03-14 16:40:45 -05:00
b50ac05510 DEV: Add APIs in the post menu to handle collapsed buttons (#31734) 2025-03-14 16:51:34 -03:00
3a0fc70e44 DEV: Add comment to clarify padding used in user-api-key encryption (#31833)
See
https://meta.discourse.org/t/user-api-keys-should-use-oaep-padding/354056
for context.
2025-03-14 14:34:44 -04:00
31aa2b3783 UX: Remove bg color on presence indicator (#31835) 2025-03-14 11:31:33 -05:00
a7f8233452 DEV: Skip flakey email change spec (#31831) 2025-03-14 10:53:28 -04:00
ef48e76104 DEV: add value transformer to allow bulk select in nav controls (#31800)
It's somewhat common for a theme to remove our topic list header: 

![image](https://github.com/user-attachments/assets/28fbe764-0944-4d96-b84e-00fd68fda385)

One issue with this is that it eliminates the bulk select button. 

Fortunately, we already have a solution for this on mobile... show it in
the navigation-controls:


![image](https://github.com/user-attachments/assets/17d0b20a-2948-4f3e-8615-7f8577adba3d)


This PR adds the `showBulkSelectInNavControls` value transformer — so we
can optionally allow this on desktop as well:


![image](https://github.com/user-attachments/assets/883975ec-95ed-44b4-85cc-6c9aa53142cd)

This provides an easy way to keep the bulk select controls without the
topic list header.

```js
  api.registerValueTransformer("bulk-select-in-nav-controls", () => {
    return true;
  });
 ```
2025-03-14 10:45:41 -04:00
f9bedc76f2 DEV: Rename fill_input -> set_input in AceEditor page object (#31825)
Follow up to dd015af0b8e9528eaabd690299cde12a0fdbe7de
2025-03-14 22:16:53 +08:00
20d19d9ca9 Build(deps-dev): Bump lint-to-the-future-ember-template from 3.0.0 to 3.1.0 (#31806)
Bumps
[lint-to-the-future-ember-template](https://github.com/mansona/lint-to-the-future-ember-template)
from 3.0.0 to 3.1.0.
- [Release
notes](https://github.com/mansona/lint-to-the-future-ember-template/releases)
-
[Changelog](https://github.com/mansona/lint-to-the-future-ember-template/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/mansona/lint-to-the-future-ember-template/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 14:13:19 +01:00
3de863c698 PERF: Remove caches from Category.subcategories & Category.descendents (#31829)
Since d2409f2964e85a4cb134f119d1bdddce54156175, these calculations are
now incredibly cheap, and the caches introduced by `@computed` become
the bottleneck. On a site with 5k+ categories, removing these caches
results in a 4x render time improvement for their homepage (~2s ->
~0.5s).

Technically, this means these properties will no longer be reactive for
places that depend on them using computed property syntax. However, they
are still reactive for modern code with autotracking. Given that the set
of categories doesn't change after initial load, I think this is
acceptable. If we do run into any issues, then we can update the related
code to use autotracking.

Note: `@dependentKeyCompat` has similar perf overheads to `@computed`,
so that's why I haven't used that for backward-compat.
2025-03-14 13:12:16 +00:00
af31058b55 Build(deps-dev): Bump the embroider group with 2 updates (#31805)
Bumps the embroider group with 2 updates:
[@embroider/compat](https://github.com/embroider-build/embroider/tree/HEAD/packages/compat)
and
[@embroider/core](https://github.com/embroider-build/embroider/tree/HEAD/packages/core).


Updates `@embroider/compat` from 3.8.3 to 3.8.4
- [Release notes](https://github.com/embroider-build/embroider/releases)
-
[Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/compat)

Updates `@embroider/core` from 3.5.3 to 3.5.4
- [Release notes](https://github.com/embroider-build/embroider/releases)
-
[Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/core)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Discourse CI <ci@ci.invalid>
2025-03-14 14:06:47 +01:00
ae08e22415 FIX: remove abandon draft dialog (#31828)
Now that we support multiple drafts, we can avoid the extra draft check
within composer when creating a new topic or reply. For posts, we
already autoload the existing draft into composer when the user tries to
create a new reply, so there is no longer a need for the abandon draft
dialog.

Drafts can still be deleted by closing the composer (using a different
dialog) or manually via the User Drafts page.

This change also correctly sets the draft key within composer actions
when switching from a post reply to a linked topic.
2025-03-14 16:15:33 +04:00
ba4ffd6836 FIX: replace positive lookbehind on checklist inputrule (#31827)
Not supported on iOS Safari <= 16.3
2025-03-14 07:31:21 -03:00
577c043487 FIX: Ensure ordering is enforced in PostsController#replies (#31826)
This was picked up by the `PostsController#replies supports pagination`
requests spec as it was flaky from time to time.
2025-03-14 17:56:26 +08:00
992bdf173a DEV: remove singleton mixin (#31823)
Removes singleton mixin and its test file.
2025-03-14 17:26:28 +08:00
09bc857d42 DEV: Fix flaky system tests due to select kit (#31821)
The "Tag synonyms when visiting edit tag page allows an admin to create
a new tag as synonym when tag does not exist" system
test was flaky with the following error:

```
Failure/Error: super

Capybara::ElementNotFound:
  Unable to find css "#add-synonyms.is-expanded"
```

Backtrace points to the following location:

```
...
./spec/system/page_objects/components/select_kit.rb:30:in `expanded_component'
./spec/system/page_objects/components/select_kit.rb:88:in `search'
...
```

What I noticed is that
`PageObjects::Components::SelectKit#expanded_component` has already
found the expanded element when it calls `#expand`. Therefore, there is
no need for us to search for it again.
2025-03-14 16:53:54 +08:00
a91a03779d DEV: Skip system tests that have been flaky (#31824)
The tests are being tracked internally to be fixed
2025-03-14 16:50:42 +08:00
32e8099258 DEV: Fix flaky system test (#31822)
The "Homepage allows users to pick their homepage" system test was flaky
because it was assuming that waiting 5 seconds was enough for the
request to save the user's preferences to complete. This may be true in
development where we have powerful development machines. In production,
Capybara's default wait time is actually 10 seconds so we should respect
that.
2025-03-14 16:10:48 +08:00
dd015af0b8 DEV: Fix flaky system test (#31820)
The "Admin editing objects type theme setting when editing a theme
setting of objects type allows an admin to edit a theme setting of
objects type via the settings editor"
system test was flaky because of the way we were filling in content into
AceEditor. It is not a normal input and does not seem to function like a
normal input. Using Capybara's `fill_in` method was not reliable so we
will just use AceEditor's API directly to update its input.
2025-03-14 15:33:09 +08:00
3165992a90 DEV: Destroy posts rake task enhancements (#31739)
This improves the new rake task to bulk delete posts based on feedback:

- Honour the `can_permanently_delete` site setting.
- Fix a warning about a scope order no being applied due to batching.
- Fix an issue where double delete would result in duplicate user
histories.
2025-03-14 13:20:43 +08:00
f3f2ae1ae7 FIX: Double wait timeout for mail deliver in email_change_spec.rb (#31818)
The tests have been flaky on CI so just double the timeouts for now.
We will investigate further if it continues to flake with the doubled
timeout.
2025-03-14 11:40:50 +08:00
5aa1e58492 DEV: Wrong test was skipped in e9244ebc6819d517c6001a92413c1814ce52656c (#31817) 2025-03-14 11:40:33 +08:00
ca835a8952 DEV: Support --headful to run system test in headful mode in bin/rspec (#31815)
Having to type `SELENIUM_HEADLESS=0` everytime is annoying and hard to
remember.
2025-03-14 10:04:31 +08:00
e9244ebc68 DEV: Skip two high frequency flaky test (#31816) 2025-03-14 10:01:31 +08:00
019b22c376 FIX: Incorrect chat DM group user count (#31813)
When creating a DM to a group in chat, we show
a count of users for that group if the number of
users exceeds SiteSetting.chat_max_direct_message_users.

However, we were also counting bot users here, we should
only be counting human users, this led to confusion because
the chat group count was different from the one on
e.g. /g/:group_name
2025-03-14 11:40:30 +10:00
7026134ddd UX: strip partial :emoji when adding emoji from picker (#31810)
When a user typed `:emoji` using the autocomplete on the rich editor,
but then used the "more" option to open the emoji picker and picked an
emoji from there, we were leaving the dangling `:emoji` there and just
added the emoji node after it.

We now check if there's a partial emoji exactly at the caret position,
and replace it too.
2025-03-13 22:01:09 -03:00
47248573fe FIX: copy image from cooked to rich editor (#31804)
When copying images from cooked, we have a `data-base62-sha1` attribute
instead of a `data-orig-src` that we were expecting.

This PR fixes it and adds a system test.
2025-03-13 21:24:24 -03:00
e1cb736704 Build(deps-dev): Bump rubocop-factory_bot from 2.27.0 to 2.27.1 (#31809)
Bumps
[rubocop-factory_bot](https://github.com/rubocop/rubocop-factory_bot)
from 2.27.0 to 2.27.1.
- [Release
notes](https://github.com/rubocop/rubocop-factory_bot/releases)
-
[Changelog](https://github.com/rubocop/rubocop-factory_bot/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop-factory_bot/compare/v2.27.0...v2.27.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 07:27:56 +08:00
04074e68c4 Build(deps-dev): Bump rubocop from 1.73.2 to 1.74.0 (#31808)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.73.2 to
1.74.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
-
[Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop/compare/v1.73.2...v1.74.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-14 07:27:36 +08:00
c307e5aa47 PERF: Optimize Category.subcategories (#31802)
At the moment, every call to `Category.subcategories` causes an
iteration through every single category. For sites with thousands of
categories, this is incredibly expensive, and makes things like the
category dropdown & sidebar rendering very slow.

To improve things, we can create a map of parent_category => [child
categories] in a single iteration, cache it, and then use that when
finding subcategories.

The `@computed` decorator ensures that this cache will be recalculated
whenever the list of categories changes (e.g. when sideloading new
categories in the experimental lazy-loaded-categories mode)
2025-03-13 22:52:54 +00:00
0da10c7639 PERF: Optimize topic-tracking-state subcategory calculation (#31801)
When opening the sidebar on a site with thousands of categories,
`getSubCategoryIds` is called repeatedly and the nested loops burn a lot
of CPU time.

The `Category.descendants` logic is similar in efficiency, but crucially
it is cached so it only needs to be calculated once per category. So
this change should make a big difference to sidebar performance on sites
with lots of categories.
2025-03-13 17:53:59 +00:00
ef006ec76b DEV: Add support for .well-known/apple-app-site-association (#31798)
We already support `/apple-app-site-association` at the root. Apple also
accepts `.well-known/apple-app-site-association` as a valid path so this
adds that as well, just in case.
2025-03-13 10:49:47 -04:00
e9eb6a916d DEV: Drop unused uppy-upload mixin (#31797)
All consumers have now been updated to use `lib/uppy/uppy-upload`
directly
2025-03-13 13:30:16 +00:00
d62db42f11 DEV: Fix livereload locally on https (#31776)
Previously, I was getting this error in the JS console:

```
livereload.js:2232 Mixed Content: The page at 'https://DOMAIN/' was
loaded over HTTPS, but attempted to connect to the insecure WebSocket
endpoint 'ws://DOMAIN:443/_lr/livereload'. This request has been blocked;
this endpoint must be available over WSS.
````

Adding a `https: true` option seems to fix the problem when running the
local server over an https proxy. (It'll be marked as `false` when the
protocol isn't https.)

This isn't just a warning, opening `/tests` is delayed about 10-20
seconds.

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2025-03-13 09:05:39 -04:00
e8f4433872 DEV: Stop using sprockets to compile service-worker js (#31796)
The service worker isn't served via normal asset paths or the CDN.
Instead, the ERB was being compiled by sprockets, fished out of the
`public/` directory by the static_controller, and then the
sprockets-specific stuff like `sourceMappingUrl` was being removed.

Instead, we can put the ERB under `views/static/`, and have it evaluate
at runtime. There are only a couple of super-cheap interpolations, plus
the route is cached in nginx, so there is no performance concern.

This takes us one step closer to removing sprockets.
2025-03-13 12:49:33 +00:00