58424 Commits

Author SHA1 Message Date
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
f87e5aab0b UX: Tweaks to the theme/component pages when using admin sidebar (#30953)
There are a number of minor changes in this commit :

1. Combine the "Themes" and "Components" links in the admin sidebar into
a single tab labelled "Themes and components"
2. The combined tab links to the `/admin/config/customize/themes` page
(titled as "Themes and components")
3. Add a new "Components" tab to the "Themes and components" page.
There's already an existing "Themes" tab
4. Add a "back to" link at the top of individual theme/component page to
navigate back to the respective tab in the "Themes and components" page
5. Remove the themes/components list/sidebar that currently serves for
navigating between themes/components
6. Remove the header in the theme/component page

Changes 4–6 apply only if the admin sidebar is enabled; they have no
effect otherwise.

Internal topic: t/146006.
2025-03-13 15:34:17 +03:00
7b5213cc8d DEV: remove user fields validation mixin (#31793)
Follow up to: https://github.com/discourse/discourse/pull/31670

This deletes the mixin.

Did a search across our repos with `/mixins\/user-field/`, only still
used in `plugin-api`.gjs which is being deleted in this PR.
2025-03-13 19:24:24 +08:00
2503e95900 FIX: ensures chat context is given to emoji picker (#31794)
This was preventing favorites emojis to work correctly as it was using
topic context. No tests for now as it's a very specific behavior hard to
test with acceptance test and a system spec seems heavy for this.
2025-03-13 10:36:01 +01:00
599107f89f FIX: Make SmallUserList change backwards compatible (#31790)
We made some changes to the SmallUserList widget in #31549. This accidentally broke at least one plugin (discourse-topic-voting) which uses it.

This fixes that by defaulting isVisible to true (old behaviour) when the argument is missing.
2025-03-13 16:27:37 +08:00
c30ddf8898 DEV: pass post as an argument for additional member info (#31782)
- The user information passed currently is very limited and in some
cases we need more info.
2025-03-13 12:38:13 +08:00
979d0ca731 FIX: Disable composer editor switch when uploading (#31789)
When you are uploading, it just causes weird problems
when you switch between markdown/rich editors, and it's
not something we really want to support. This commit
disables the Composer::ToggleSwitch while uploading.
2025-03-13 13:13:44 +10:00
e080712c24 DEV: Support connecting to Redis with a username. (#31710)
Redis / Valkey over TLS requires authentication involving both a
username and a password.

On most instances, the default username is `default`, but this allows
Discourse to provide its own.
2025-03-13 10:39:50 +08:00
d1a8ed1beb FEATURE: add horizontal_rule rich editor input rule (#31788)
Adds support to typing `---`, `___` or `***` to create a horizontal
rule.

Converting when typing `---` is actually written here as an en-dash +
`-`, because the typographer replacements extension turns `--` into an
en-dash first.

`___` and `***` are only triggered after a whitespace, because they
could also mean bold+italic.
2025-03-12 22:45:10 -03:00
6820622467 DEV: Add protection for migrations that creates index concurrently (#31763)
This commit updates `Migration::SafeMigrate` to protect against unsafe
ways of adding a Postgres index concurrently.

Per postgres documentation:

If a problem arises while scanning the table, such as a deadlock or a
uniqueness violation in a unique index,
the CREATE INDEX command will fail but leave behind an "invalid" index.
This index will be ignored for querying
purposes because it might be incomplete; however it will still consume
update overhead. The recommended recovery
method in such cases is to drop the index and try again to perform
CREATE INDEX CONCURRENTLY .

Therefore, the simplest way for us to ensure that migrations that create
indexes concurrently are idempotent is to follow postgres'
recommendation of dropping the index first before trying to create the
index concurrently.
2025-03-13 09:34:14 +08:00
962bdf3697 FIX: use virtualElementFromTextRange on emoji autocomplete more (#31783)
There's no `textarea` with the rich editor, so being `undefined` it
fails with a `TypeError: Cannot read properties of undefined (reading
'id')`.

This has the same behavior with the textarea editor but works much
better (positioning closer to the caret) with the rich editor.
2025-03-12 22:24:40 -03:00
9b692ede96 UX: make an em-dash from en-dash plus hyphen on rich editor (#31787)
As `--` is converted to an en-dash, we need to make an en-dash plus
another `-` into an em-dash.
2025-03-12 22:22:08 -03:00
d1b63e3056 DEV: Delete topic map specs (#31785)
These specs are causing far more flakes and trouble than they are worth,
I think it's just the killer
combination of relying on messagebus and background jobs along with the
specs being quite big. Let's just get rid of them...
2025-03-13 10:51:02 +10:00
159aa43cfe UX: add title and aria-label to md/rich editor toggle (#31784) 2025-03-12 20:53:09 -03:00
ce05f9ece5 Build(deps-dev): Bump @swc/core from 1.11.8 to 1.11.9 (#31781)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.8 to
1.11.9.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/swc-project/swc/compare/v1.11.8...v1.11.9)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 23:31:12 +01:00
85f68623b5 Build(deps-dev): Bump rubocop-capybara from 2.22.0 to 2.22.1 (#31779)
Bumps [rubocop-capybara](https://github.com/rubocop/rubocop-capybara)
from 2.22.0 to 2.22.1.
- [Release notes](https://github.com/rubocop/rubocop-capybara/releases)
-
[Changelog](https://github.com/rubocop/rubocop-capybara/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop-capybara/compare/v2.22.0...v2.22.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 23:06:28 +01:00
d9e86c550d Build(deps): Bump minitest from 5.25.4 to 5.25.5 (#31778)
Bumps [minitest](https://github.com/minitest/minitest) from 5.25.4 to
5.25.5.
-
[Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc)
-
[Commits](https://github.com/minitest/minitest/compare/v5.25.4...v5.25.5)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 23:06:17 +01:00
935c3dc9a3 Build(deps-dev): Bump @ember/test-waiters from 4.0.0 to 4.1.0 (#31780)
Bumps
[@ember/test-waiters](https://github.com/emberjs/ember-test-waiters)
from 4.0.0 to 4.1.0.
- [Release
notes](https://github.com/emberjs/ember-test-waiters/releases)
-
[Changelog](https://github.com/emberjs/ember-test-waiters/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emberjs/ember-test-waiters/commits)

---------

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-12 23:05:32 +01:00
6a80c6bf43 UX: remove auto-conversion from .. -> … (#31770) 2025-03-12 15:48:38 -03:00
f07ce80583 DEV: discourse-emojis 1.0.38 (#31775)
Removes components emojis (white_hair, curly_hair, red_hair,bald) which
were showing in search.
2025-03-12 19:31:48 +01:00
897b043f01 DEV: Add code comments around oauth user-api-key/new handling (#31774)
Followup to #31759
2025-03-12 14:01:20 -04:00
f2fda8e8b9 Build(deps): Bump json from 2.10.1 to 2.10.2 (#31772)
Bumps [json](https://github.com/ruby/json) from 2.10.1 to 2.10.2.
- [Release notes](https://github.com/ruby/json/releases)
- [Changelog](https://github.com/ruby/json/blob/master/CHANGES.md)
- [Commits](https://github.com/ruby/json/compare/v2.10.1...v2.10.2)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 18:46:31 +01:00
1f2043de4e DEV: removes code block enter edge case (#31773)
This was causing some confusion and now that we have the chat preference
to send with enter or metakey+enter it's even more confusing.

If your setting is send on enter, you need to use shift+enter for a new
line, even in codeblocks. If your setting is meta+enter you need to use
enter in the codeblock for a new line, meta+enter will send as expected.
2025-03-12 18:01:00 +01:00
38ba191be0 FIX: Ensure auth completes correctly when going via /user-api-key/new for new users (#31759)
A new user joining a community via DiscourseHub and logging in via oauth
goes through this process. This would break down for two reasons.

Reason 1: in some cases, especially on Safari mobile, the redirect in
the omniauth callback was happening too early. A new user may not be
signed in yet by that point, which means the redirect to
`/user-api-key/new` triggers a redirect to `/login` which ends up in a
bit of an infinite loop. Not all browsers exhibited this behaviour, but
Safari definitely did.

Reason 2: `/user-api-key/new` is gated via group membership using the
`user_api_key_allowed_groups` site setting. By default that is set to
include `trust_level_0`, however, auto group assignment wasn't taking
place for all user `create` events (only some that go through staged
users).
2025-03-12 11:58:59 -04:00
9bb4257810 UX: Remove forced block display in dmenu (#31768) 2025-03-12 15:19:00 +01:00
25e8b5af9f FEATURE: Introduce new color palettes config area (#31742)
As part of the theme/color palette overhaul project, we're introducing a
new admin page for editing color palettes. The new page is located at
`/admin/config/colors/:id`. It's linked from anywhere, but it will be
linked in the sidebar as we progress more in the overhaul project.

Related PRs: https://github.com/discourse/discourse/pull/30893
https://github.com/discourse/discourse/pull/30915
https://github.com/discourse/discourse/pull/31328.

Internal topic: t/148628.
2025-03-12 16:57:31 +03:00
69fa96df21 FIX: Add metadata to /hot RSS feed (#31766)
Some RSS readers require metadata to be present.
2025-03-12 08:56:22 -04:00
1cb940b113 DEV: replace UserFieldsValidation mixin with helper class (#31670)
This PR refactors the UserFieldsValidation mixin into a helper class.

### Key Changes
* moved this.userFields to a tracked collection of TrackedUserFields
stored on the helper class itself
* introduced `validationVisible` property to explicitly control when to
display the validation result, we expect the helper to not display
validation until form submission in the `SignupController` and
`CreateAccount` components.
* added backward compatibility to the plugin API
`addCustomUserFieldValidationCallback` to ensure ex-Core instances of
the mixin continues working till we remove them
2025-03-12 20:50:53 +08:00
b56816ad70 Build(deps): Bump the babel group with 2 updates (#31757)
Bumps the babel group 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.26.9 to 7.26.10
- [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.26.10/packages/babel-core)

Updates `@babel/standalone` from 7.26.9 to 7.26.10
- [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.26.10/packages/babel-standalone)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-12 12:11:17 +01:00