34945 Commits

Author SHA1 Message Date
Martin Brennan
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
Jordan Vidrine
0ebd0a0bd5
UX: Refactor, removal, cleanup (#31839) 2025-03-14 16:40:45 -05:00
Sérgio Saquetim
b50ac05510
DEV: Add APIs in the post menu to handle collapsed buttons (#31734) 2025-03-14 16:51:34 -03:00
Penar Musaraj
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
Kris
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
David Taylor
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
dependabot[bot]
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
David Battersby
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
Alan Guo Xiang Tan
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
Kelv
992bdf173a
DEV: remove singleton mixin (#31823)
Removes singleton mixin and its test file.
2025-03-14 17:26:28 +08:00
Ted Johansson
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
Renato Atilio
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
Renato Atilio
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
David Taylor
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
David Taylor
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
David Taylor
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
Penar Musaraj
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
David Taylor
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
Osama Sayegh
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
Kelv
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
Ted Johansson
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
Amanda Alves Branquinho
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
Martin Brennan
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
Kevin Hwang
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
Renato Atilio
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
Renato Atilio
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
Renato Atilio
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
Renato Atilio
159aa43cfe
UX: add title and aria-label to md/rich editor toggle (#31784) 2025-03-12 20:53:09 -03:00
dependabot[bot]
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
dependabot[bot]
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
Renato Atilio
6a80c6bf43
UX: remove auto-conversion from .. -> … (#31770) 2025-03-12 15:48:38 -03:00
Joffrey JAFFEUX
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
Penar Musaraj
897b043f01
DEV: Add code comments around oauth user-api-key/new handling (#31774)
Followup to #31759
2025-03-12 14:01:20 -04:00
Penar Musaraj
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
chapoi
9bb4257810
UX: Remove forced block display in dmenu (#31768) 2025-03-12 15:19:00 +01:00
Osama Sayegh
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
Penar Musaraj
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
Kelv
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
dependabot[bot]
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
dependabot[bot]
36c9d75f19
Build(deps-dev): Bump @embroider/core from 3.5.2 to 3.5.3 in the embroider group (#31735)
Bumps the embroider group with 1 update:
[@embroider/core](https://github.com/embroider-build/embroider/tree/HEAD/packages/core).


Updates `@embroider/core` from 3.5.2 to 3.5.3
- [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-12 11:53:01 +01:00
David Taylor
1d0d7ddbb5
DEV: [gjs-codemod] convert first batch of files to gjs
Updated using `@embroider/template-tag-codemod`, plus some manual fixups.

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2025-03-12 08:54:04 +00:00
David Taylor
ca2f974f38
DEV: [gjs-codemod] merge js and hbs 2025-03-12 08:49:36 +00:00
David Taylor
a4fce08c7c
DEV: [gjs-codemod] renamed hbs to gjs 2025-03-12 08:49:14 +00:00
David Taylor
7f3f4af12f
DEV: [gjs-codemod] renamed js to gjs 2025-03-12 08:49:03 +00:00
Renato Atilio
623f02aff6
FEATURE: add details (plugin) rich editor extension (#31718)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds `details` and `summary` nodes, parsers, and serializers, and a
click handler to toggle the `open` attribute.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-03-11 20:15:32 -03:00
Renato Atilio
d1870d4811
FEATURE: add local-dates (plugin) rich editor extension (#31714)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds `local_date` and `local_date_range` nodes, parsers, and
serializers.
2025-03-11 20:13:09 -03:00
Renato Atilio
d56e69e7c0
FEATURE: add trailing-paragraph rich editor extension (#31713)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a plugin to enforce an empty trailing paragraph.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-03-11 20:12:31 -03:00
Renato Atilio
c9518f2384
FEATURE: add onebox rich editor extension (#31691)
Continues the work done on
https://github.com/discourse/discourse/pull/30815.

Adds a `onebox` and an `onebox_inline` node spec, their serializers, and
a plugin that automatically converts links to oneboxes.
2025-03-11 20:09:33 -03:00
Kris
b4f9626984
DEV: allow render-tags to pass classes so we can use it in the history modal (#31755) 2025-03-11 17:34:04 -04:00
Kris
0a31aaa9e3
UX: restore CSS tag comma separator for Discourse oneboxes (#31756)
This is a follow-up to 55a3a4e, this restores the tag separator using
CSS — core's tags are no longer separated this way but it's necessary in
the Discourse oneboxes

Before:

![image](https://github.com/user-attachments/assets/d2cce1de-58df-49f3-93df-25aa26b89500)


After:

![image](https://github.com/user-attachments/assets/9a6dc82f-c82e-4c91-b695-2f855c0661b6)
2025-03-11 16:03:33 -04:00