34945 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
871356f547
UX: Improve UX of 2FA token submission page (#31918)
This commit updates the 2FA token submission page to disable the submit
button when the 2FA token is not valid and to also set the submit button
to be in the loading state after the submit button has been clicked.

The UX issues were discovered while I was investigating a flaky test
which has been unskipped in this commit as well. I am not sure if  this
will completely resolve the flakiness but we have to unskip it to know
if it continues to be flaky.
2025-03-21 08:49:12 +08:00
Martin Brennan
832ed8ce74
UX: Fix various search shortcut UX issues (#31903)
Now we have the search input showing in a few
different configurations:

* Welcome banner
* Header field
* Header icon

And we can get to the search with both `/` and
`Ctrl+F` shortcuts. These configurations can
be used together, and we need to focus on the right
search input at the right time.

This commit fixes the shortcuts not working
or showing the wrong thing in some cases,
and adds a comprehensive system spec for all
the variants.
2025-03-21 09:20:58 +10:00
chapoi
712302c020
UX: add mini z-index to welcome banner to fix overflowing result pane… (#31927)
…l opacity hickup

Fixing the opacity issue caused by the slight delay animation
2025-03-20 19:13:47 +01:00
Joffrey JAFFEUX
94e5630ec3
DEV: adds declarative options to object/container (#31934)
We often need to be able to change the format of a container and to
change the flex-direction, this is now possible through two properties:

`<form.Container @format="large">`
`<form.Container @direction="column">`

On top of this `Object` has now a similar behavior to `Collection`. It
will be displayed as flex, add gap between children and accepts
`...attributes`.
2025-03-20 14:58:54 -03:00
David Taylor
38872b5b9b
FEATURE: Introduce warning banner for Safari 15 deprecation (#31928)
Ref https://meta.discourse.org/t/safari-15/358131
2025-03-20 15:03:24 +00:00
David Taylor
5f8a183abf
FIX: Stop non-rgb header background colors crashing DiscourseHub (#31929)
Ideally we would add support for color spaces like okclh to the app, or
have some method for converting them to rgb automatically. But for now,
this will stop the app crashing completely.
2025-03-20 13:56:07 +00:00
Joffrey JAFFEUX
7f9a0bb2a7
FIX: prevents fields in Object to re-render (#31916) 2025-03-20 08:32:22 +01:00
Martin Brennan
897d34132e
FIX: Add value transformers for welcome banner and search (#31917)
We want to give some themes more control over
the default experience in core. To this end, this
commit adds value transformers for these
site settings:

* enable_welcome_banner
* search_experience

This way, themes can give a different value to
what has been set in core.

This can be potentially confusing, a follow up PR
may refactor this a bit so there is a more direct
correlation between the setting and the transformer
so we could show a warning in the site setting page
for example.
2025-03-20 15:37:42 +10:00
dependabot[bot]
eef5ced7b7
Build(deps-dev): Bump sinon from 19.0.2 to 19.0.4 (#31914)
Bumps [sinon](https://github.com/sinonjs/sinon) from 19.0.2 to 19.0.4.
- [Release notes](https://github.com/sinonjs/sinon/releases)
-
[Changelog](https://github.com/sinonjs/sinon/blob/main/docs/changelog.md)
- [Commits](https://github.com/sinonjs/sinon/compare/v19.0.2...v19.0.4)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-20 09:06:54 +08:00
Kevin Hwang
0cdbd40866
FIX: Increase uploads.origin column length to 2000 to accommodate longer S3 pre-signed URLs for user uploads. (#31803)
The current limit is too small for the way Discourse currently stores a
pre-signed S3 URL for each upload in the form of:

```
https://{bucketname}.s3.dualstack.{region}.amazonaws.com/original/1X/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=XXXXXXXXXXXXXXXXXXXX%2FYYYYMMDD%2F{region}%2Fs3%2Faws4_request&X-Amz-Date=YYYYMMDDTHHMMSSZ&X-Amz-Expires=xxxxxx&X-Amz-SignedHeaders=host&X-Amz-Security-Token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

The problem here is that this URL, without the S3 bucket name and AWS
region portion of the URL, is already nearly 1000 chars long.

If you have an even slightly longer bucket name or region, it will
easily go over 1000.

---

The more proper fix would be not to store these "template" S3 pre-signed
URLs in the `origin` column to begin with.

S3 pre-signed URLs aren't meant to be persisted (they're by nature
"one-time" use, scoped to a short window), and they have to be
re-generated for each user request anyway, because they have a maximum
validity of 7d (in practice Discourse generates them with a lifetime of
300s), so the value stored in the `origin` column is more of a
"template" that gets discarded and a real pre-signed URL generated
on-the-fly each time a user comes anyway. So the value in the `origin`
column isn't even doing anything.

The proper way would be to store the S3 bucket name, region, and object
key, which is compact, and the three pieces of info from which it is
sufficient to generate pre-signed URLs each time a user requests.
2025-03-20 09:05:35 +08:00
Bianca Nenciu
bdc30ca3a0
FIX: Force pagination only if more than 1000 subcategories (#31507)
Commit f1700ca58929bcbfad23565861d1d3084ae1b3f8 ensures that categories
are loaded lazily, in pages, if the number of visible categories is over
1000. This affected the list of subcategories on the category page too.

The logic has been changed to only paginate if the number of categories
that would have been returned is grater than 1000. For example, if there
is a parent category filter, pagination will only be enforced if the
number of subcategories is over 1000.
2025-03-20 00:12:14 +02:00
Renato Atilio
bd92b050cf
UX: editor-specific getCaretCoords to position emoji picker on autocomplete's more (#31884)
Uses `getCaretCoords` from the text manipulation implementation to rely
on each editor's strategy to get the caret (left,top) positions.

This is mostly to fix an issue on Safari, where the virtual element
approach doesn't work, but also improves the emoji picker positioning
when triggered from autocomplete in the Markdown editor.
2025-03-19 18:55:41 -03:00
Renato Atilio
2a73387029
FIX: paste url on rich editor with partial paragraph selected (#31906)
Fixes an incorrect logic on `transformPasted` that was causing a
`TypeError: Cannot read properties of null (reading 'marks')` when only
part of a paragraph was selected.

Adds tests
2025-03-19 17:47:08 -03:00
Joffrey JAFFEUX
51569a7901
DEV: ensures rows and collections are full width (#31907) 2025-03-19 17:00:46 +01:00
Joffrey JAFFEUX
12d3176d89
DEV: adds support for primitive collections in form-kit (#31882)
Before this commit form-kit couldn't represent this shape of data:
`[1,2,3]`, it could only represent: `[{value: 1}, {value: 2}]`.

The above data can now be expressed with this form:

```gjs
<Form @data={{hash foo=(array 1 2 3)}} as |form|>
  <form.Collection @name="foo" as |collection|>
    <collection.Field @title="time" as |field|>
      <field.Input @type="number" />
    </collection.Field>
  </form.Collection>
</Form>
```
2025-03-19 14:53:27 +01:00
Loïc Guitaut
2ed31fea64 DEV: Upgrade the Redis gem to v5.4 2025-03-19 14:34:00 +01:00
Osama Sayegh
d4cbdf3ee0
FIX: Restore old admin themes/components page (#31887)
Follow-up to https://github.com/discourse/discourse/pull/30953

This PR is a partial revert of the linked PR — it changes the "Themes
and components" link in the admin sidebar back to the legacy
`/admin/customize/themes` page and adds the themes list/sidebar back to
the left hand side of the page. The new `/admin/config/customize/` route
is still available, but it's not linked from anywhere. When accessing
the new page and then navigating to a theme, the old components (e.g.
the themes list) of the page are hidden. This allows us to iterate on
the new page and improve until we're more ready to make it available
more widely.
2025-03-19 16:18:26 +03:00
Alan Guo Xiang Tan
80118c8891
DEV: Attempt to fix flaky system tests around email confirmation (#31904)
Both tests being unskipped here failed previosly with the following
error:

```
Failure/Error: expect(page).to have_current_path("/u/#{user.username}/preferences/account")
  expected "/u/confirm-new-email/f42a416fcbca40d66788d65a8837ad49" to equal "/u/bruce306/preferences/account"

./spec/system/email_change_spec.rb:49:in `block (2 levels) in <main>'
```

The error indicates that the transition was not successful and I
suspect that it may be due to the use of the `/my` route prefix which
is just a nice to have and not necessary.
2025-03-19 18:44:05 +08:00
David Taylor
a017f566a8
DEV: [gjs-codemod] convert second 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-19 10:20:56 +00:00
David Taylor
f049f775c7
DEV: [gjs-codemod] merge js and hbs 2025-03-19 10:18:20 +00:00
David Taylor
27f17ccee2
DEV: [gjs-codemod] renamed js to gjs 2025-03-19 10:18:19 +00:00
David Taylor
b0f19109b3
DEV: [gjs-codemod] renamed hbs to gjs 2025-03-19 10:18:12 +00:00
Ted Johansson
c0630dbee4
DEV: Make group auto e-mail domain limit configurable (#31873)
We currently limit the number of characters in the bar-separated list of auto-membership e-mail domains. We want to make this configurable through site settings.

After this change, we limit the length of each individual domain, and enable the number of domains to be configured through a hidden site setting.

The original limit is there to prevent DoS, since a TEXT column can take up to 1Gb. With this new limit we're still at a maximum of around 10kb.
2025-03-19 14:33:50 +08:00
Kelv
7d402ddb76
DEV: remove unnecessary use of buffered mixin in share-topic modal (#31871)
Use of the buffer API within this component was removed back in
https://github.com/discourse/discourse/pull/23940.
2025-03-19 12:37:37 +08:00
Martin Brennan
22a00fd872
UX: Add separator for "Learn more..." on admin pages (#31898)
We have this rule in

https://meta.discourse.org/t/formatting-text-in-discourse-documentation-and-uis/324637:

> Do not use a period for the following:
>
> Tooltips, image captions, or other UI elements with only one sentence

However, this looks strange on some admin pages because we also show
a "Learn more..." link after the header description, which kind of
runs on into the link.

This commit adds a separator after the link to address this issue.
2025-03-19 13:34:17 +10:00
Martin Brennan
625d086f35
UX: Themes & components I18n adjustments (#31897)
Moves the Themes & components I18n text to use the
admin > config structure, so the description shows
up properly in admin search
2025-03-19 13:24:05 +10:00
Ted Johansson
e63716d650
FIX: Updating a group without e-mail domains (#31896)
The change made in #31854 introduced a regression when editing groups, preventing saving when no auto membership e-mail domains are entered.

This change fixes that and adds a system test.
2025-03-19 10:38:41 +08:00
Krzysztof Kotlarek
622d681f96
FIX: twitter_summary_large_image is renamed to x (#31870)
In this PR x_summary_large_image was introduced but now updated in all
places.

Also `min_first_post_typing_time` deprecation should not be removed.
2025-03-19 11:55:11 +11:00
Osama Sayegh
a34e0433cc
FEATURE: Allow typing/pasting colors in palette editor (#31811)
Follow-up to https://github.com/discourse/discourse/pull/31742

Adding a text input field to type in or paste color values can be useful
when creating/editing a color palette with specific colors.
2025-03-19 03:45:22 +03:00
Jordan Vidrine
52cfe766f9
UX: Remove bg color on search info (#31895) 2025-03-18 19:43:27 -05:00
Renato Atilio
6fa6d32ac4
UX: avoid autocomplete/input rules on rich editor inline code (#31836)
Avoids autocompleting or applying mention/emoji/hashtag/any input rules on
rich editor inline code.

There's also a refactor on how the params are passed to input rules – we
now use the same params from plugins, keeping it more consistent.
2025-03-18 20:23:17 -03:00
Jarek Radosz
e242edd40d
DEV: Fix scss deprecation warning (#31893) 2025-03-18 23:51:48 +01:00
Jarek Radosz
d21aa14e2c
DEV: Do not use string based actions in components (#31891) 2025-03-18 22:54:08 +01:00
David Taylor
9e7384298b
DEV: Introduce postcss minmax transform (#31885)
This will auto-transform media query range syntax like `width < 100px`
into the more-widely-supported min/max-width syntax
2025-03-18 19:28:52 +00:00
Ted Johansson
1a7303a35e
FIX: Amend broken group automatic member dialog (#31854)
When creating or editing a group, we are meant to show a dialog telling the admin how many members will be automatically added.
2025-03-18 19:37:37 +08:00
Renato Atilio
b1b2b8e4c8
UX: keep existing marks when pasting a url to make a link in rich editor (#31814) 2025-03-18 07:15:35 -03:00
Jordan Vidrine
76dce62cf2
DEV: Move media query to breakpoint scss (#31865) 2025-03-17 20:37:56 -05:00
Gary Pendergast
9d14492f22
FIX: When displaying a reviewable, don't append the title to the content (#31851)
Follow up to e4401e587e98ac4020c2c4fd965e227146cf33d4.

In the previous change, when serialising a Reviewable post, we were appending the title to the post content whilst checking for watched word matches. This append action was acting upon the object itself, rather than just a copy of the string, causing the UI to display the title appended twice to the content.

Fortunately, since it was only happening in the serialiser, the incorrect data was never stored in the database, it was only happening when viewing the review queue.
2025-03-18 11:57:39 +11:00
Gary Pendergast
6cd282eeb3
FEATURE: Display a toast popup after completing a review action. (#31786)
When performing an action in the review queue, this change makes two improvements:

- The buttons on the reviewable item are disabled, so you can't accidentally multi-click.
- A toast is displayed when the action is complete, as a success indication.
2025-03-18 11:26:59 +11:00
Krzysztof Kotlarek
429a10b2b9
FIX: uploader lightbox preview for new images (#31762)
It is an old bug that preview is not working for newly uploaded images.
To fix it, we need to initialize lightbox when image is rendered and not
when component.

We have Qunit test when image is already available
https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.gjs#L28

System test was added to ensure lightbox is working right after image is
uploaded.

<img width="1236" alt="Screenshot 2025-03-12 at 10 23 18 am"
src="https://github.com/user-attachments/assets/3984306b-f351-4b35-936c-eb7f0e57ea9d"
/>

After fix


https://github.com/user-attachments/assets/1091cd55-b24b-4640-8e8f-a60c3426ff65
2025-03-18 10:01:55 +11:00
Jordan Vidrine
998264b665
UX: header search adjustments (#31863) 2025-03-17 17:59:21 -05:00
Kris
2e2e2b37ff
UX: re-hide hidden upload field (#31861)
follow-up to
6d92165ae7,
rehides this:


before:


![image](https://github.com/user-attachments/assets/34f07b8c-a547-476f-bfc4-ba92bd6f056e)


after: 


![image](https://github.com/user-attachments/assets/d2f18305-75e0-47f2-9ef9-d3a3a31d43d6)
2025-03-17 14:54:37 -04:00
Kris
7b874b6a85
DEV: merge mobile stylesheets into common (#31838)
This eliminates the mobile dashboard, edit-category, and sidebar
stylesheets and moves the relevant styles into the common directory
files
2025-03-17 13:53:05 -04:00
Penar Musaraj
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
Kris
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
Isaac Janzen
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
David Taylor
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
Joffrey JAFFEUX
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
dependabot[bot]
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
Martin Brennan
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