Commit Graph

58932 Commits

Author SHA1 Message Date
25938208ff FIX: recalculate respects default invitee trust level (#32393)
Currently, trust level is calculated with this formula:
`[granted_trust_level, previous_trust_level,
SiteSetting.default_trust_level].max`

When a user is invited, SiteSetting.default_invitee_trust_level should
be respected in that calculation.
2025-04-23 09:49:44 +08:00
e4c70e37cc DEV: remove scroll-top mixin file (#32398)
Follow up to https://github.com/discourse/discourse/pull/32367, and
removal of references to this mixin file from other supported repos.

This deletes the mixin file, the logic is duplicated in
1e0d773b54/app/assets/javascripts/discourse/app/lib/scroll-top.js.
2025-04-23 09:45:38 +08:00
b888ec07cb UX: Chat more message actions adjustments (#32404) 2025-04-22 16:36:21 -05:00
822a4f8195 UX: avoid nested paragraph tags causing extra large category descriptions (#32403)
It seems there are some situations where we can get nested paragraph
tags in category headings, and in these cases we end up with
twice-as-large descriptions. Moving the font-size rule to the parent
avoids this.


Before:

![image](https://github.com/user-attachments/assets/c4ff27e3-a16f-463a-a330-04d44e178f7e)


After:

![image](https://github.com/user-attachments/assets/b33e9a8e-6b48-48b8-b13f-76736aac1ac3)
2025-04-22 16:12:47 -04:00
f9273ddcb7 A11Y: add aria-label to reply count link in topic list (#32402)
At the moment the reply count is labelled by the topic list's header
column, which is good — but we don't actually describe what the link
does, so it's a little ambiguous.

This adds an aria-label to describe the behavior "jump to first post" so
it will be read as:

"n replies, jump to first post" 

This provides better coverage for link-to-link navigation because it
both describes the number and the function.
2025-04-22 15:22:52 -04:00
e887a389fe DEV: generate identifier for collections (#32368)
This is particularly important for array of primitives, eg: `["a", "b",
"c"]` where ember will struggle to know it's re-rendering the same
object.

The previous code was mostly working by chance as calling index on
something almost works for anything in javascript. But since we
introduced array of primitives in collections, we could now end up with
an `undefined` value for the items of the collection, and calling
`index` on `undefined` would raise an error.

This commit create a more general and explicit solution to this problem.
2025-04-22 14:33:40 +02:00
8367819b1b DEV: Attempt at stabilizing components listing page system spec (#32352)
This commits reworks the assertions for components shown on the components listing page to eliminate flakiness we've seen with those assertions.
2025-04-22 11:04:10 +03:00
b2ce374650 FIX: error when trying to un-favorite badge (#32369)
This PR addresses the issue discussed in
https://meta.discourse.org/t/failed-error-when-trying-to-un-star-the-bug-reporter-badge/330523

1. Fixed an issue in `user_badges_controller.rb` where the
`toggle_favorite` method could incorrectly treat badges already marked
as favorite as not being favorite.
2. Automatically synchronize the `is_favorite` status for new badges
when a user is granted a multiple-grant badge.
2025-04-22 15:36:48 +08:00
b0ab1b2321 FEATURE: Show translated category names from localizations table if they exist for the user locale (#32380)
This PR adds category localization support to core.

- Depends on https://github.com/discourse/discourse/pull/32378
- Creates the required table `category_localizations`
- Makes use of the site category cache to display localized categories
- Supports name and description
- This does not yet include /categories page. (coming in a next PR)

## Before

<img width="1089" alt="Screenshot 2025-04-21 at 4 31 43 PM"
src="https://github.com/user-attachments/assets/9e49b21b-b16a-43d2-9b16-0fd0324a21ca"
/>

## After

<img width="1085" alt="Screenshot 2025-04-21 at 4 32 42 PM"
src="https://github.com/user-attachments/assets/7bfa21a2-6df2-4cdf-a00a-d044c3526a40"
/>
2025-04-22 15:13:19 +08:00
d5b2b186b4 DEV: Cache categories by locale (#32378)
Our category cache is currently specific to the site locale.

Expanding the key to take in `I18n.locale` as well to accommodate for
category translations in core.
2025-04-22 13:10:53 +08:00
2e5f11cc16 DEV: Remove Other admin section (#32392)
Over the past couple of weeks we've been adding Settings tabs to a lot of admin sections, to categorize some of the previously uncategorized site settings.

Now that all that is done, we can remove the Advanced > Other section, which used to contain them.
2025-04-22 11:58:16 +08:00
0252712008 DEV: Add --exclude-pattern to bin/turbo_rspec (#32390)
This commit adds a new `--exclude-pattern` CLI option which supports
excluding files using unix style pattern matching.

This is to simplify a couple of situations:

1. Running `bin/turbo_rspec plugin/spec` but we want to exclude all
   tests in the `plugin/spec/system` folder.

   Example: `bin/turbo_rspec --exclude-pattern="*spec/system*"
plugin/spec`

2. Running `bin/turbo_rspec plugin/*/spec/system` but we want to exclude
   tests for a particular plugin.

   Example: `bin/turbo_rspec --exclude-pattern="plugins/chat/*"
plugin/*/spec/system`
2025-04-22 11:34:48 +08:00
1d7b08f2e1 DEV: Add dedicated admin groups page (#32377)
Previously, clicking "Groups" on the admin dashboard would bring you to the public groups page. Historically, the public and admin actions have been mixed together on that page.

This is a bit of a frustrating experience when working on the admin dashboard, and also prevented us from adding a "Settings" tab for group-related site settings.

This PR adds an "admin groups" page, which is just an exact copy of the public groups index for now. This allows us to add the "Settings" tab, and lets us gradually work un disentangling the public- and admin parts of groups.
2025-04-22 11:23:25 +08:00
8cfb6d62d4 DEV: stylint fix (#32391)
A fix for previous PR stylint eror
2025-04-22 10:44:39 +08:00
93fc50c915 UX: Experiment with animation (#32341) 2025-04-21 21:00:21 -05:00
3cc2b8540f DEV: Remove broken CLI option in bin/turbo_rspec (#32388)
The `--disable-system-tests` CLI arg does nothing
2025-04-22 09:00:33 +08:00
d29d6e562d UX: small-fixes (#32387) 2025-04-21 17:59:02 -05:00
25b4e7c61b FIX: remove z-index from user-status in header (#32382)
After some new changes in the header, the user-status' z-index caused
issues
![CleanShot 2025-04-21 at 13 41
39@2x](https://github.com/user-attachments/assets/a417dd20-842d-47d1-92cd-9b1ae37b1ab6)

AFAICT there is no need for that z-index to begin with.
2025-04-21 16:31:48 +02:00
2ec0bf32da DEV: Fix broken request/qunit_controller_spec.rb (#32376)
This test file fails locally if `tmp/theme-transpiler.js` does not
exists.
Since the test file stubs the production env, we have to ensure that
`DiscourseJsProcessor::Transpiler.build_production_theme_transpiler` is
run first to mirror the production environment where the theme
transpiler file is built as part of assets precompilation.

### Review notes:

Example failure:
https://github.com/discourse/discourse/actions/runs/14529161497/job/40766003075

To repro locally, run the following steps: 

1. In your Discourse directory, run `rm -rf tmp`
2. `rspec spec/requests/qunit_controller_spec.rb`
2025-04-21 13:46:25 +08:00
d524bbd339 DEV: Convert groups page to components (#32279)
We need to reuse some of the groups UI in the admin dashboard. This is currently a bit hairy because it's using the old controller + routes + template style design.

This PR extracts to components, GroupCard, and GroupList, and shifts the logic in there.
2025-04-21 13:11:11 +08:00
e8997b6202 DEV: Add Settings tab to admin Badges page (#32251)
This change does two things:

Modernizes the admin badges UI implementation. (Routes + controllers → components + services.)
Adds a Settings tab to the new badges page.
For all intents and purposes, this change is a lift-and-shift modernization. The addition of the settings tab is trivial once that is covered.
2025-04-21 09:41:29 +08:00
1e0d773b54 DEV: duplicate scroll-top util function to lib and replace current usage with new path (#32367)
This was refactored from an actual Mixin some time back. This PR moves
the function to the lib folder and keeps the same logic/interface
otherwise.

We'll remove the mixin file once all non-core repos change to use the
new file.
2025-04-21 08:12:51 +08:00
e47b0996ed FIX: enable drafts dropdown on private categories (#32370)
Reinstates the draft dropdown on private category pages.
2025-04-18 17:38:35 +04:00
6c4e9dfbc8 DEV: Try fix composer rich text transcript spec (#32364)
This is to try fix this error by sending the keys
on the element itself:

```
Failure/Error: page.send_keys([PLATFORM_KEY_MODIFIER, "v"])

Selenium::WebDriver::Error::StaleElementReferenceError:
  stale element reference: stale element not found in the current frame
    (Session info: chrome=135.0.7049.84); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#stale-element-reference-exception
```
2025-04-18 15:52:35 +10:00
9b5ada304f UX: avoid auto-linking clash with code marks on rich editor (#32365)
Avoid auto-linking URLs within code marks

Avoid auto-linking URLs when there's a `` ` `` just before the matched
URL, assuming the user is about to type a closing `` ` `` to create a
code mark instead.
2025-04-18 01:11:59 -03:00
1c8646b48e DEV: Refactor forcing admin sidebar logic in hamburger nav mode (#32257)
This PR allows for other code to force the sidebar, but making the
language not admin-specific. There is a general problem to solve of "how
can I force the sidebar to appear, while keeping the hamburger menu in
the header as-is". This problem is solved for admin interface, but the
variable naming made it seem like the logic was directly tied to the
admin UI.

It is easy with this change, to have another sidebar manager force the
sidebar to be open for a route. Technically it was easy before, but it
would look like you were doing awful hacks.

---------

Co-authored-by: Isaac Janzen <isaac.janzen@discourse.org>
2025-04-17 22:36:38 -05:00
f06175b72d UX: prosemirror rich editor nodes cleanup / slightly better UX (#32361)
We don't want "ghost" `content` within mention/hashtag, as they're
already rendering their non-editable content on `toDOM`.

`atom: true` is not necessary for content-less nodes

Re-use existing heading node spec instead of re-creating.

A UX improvement from these changes is a better Cmd-Left/Home navigation
when these nodes begin a paragraph and the caret is after them.
2025-04-18 00:20:55 -03:00
2b4521d0b3 FIX: pasting img on rich editor could be double-processed (#32356)
Without the `useCapture` as `true` on this `ComposerUpload`'s
`addEventListener`, if the clipboard contained both a Files array and a
`text/html` item, the paste event would be captured by ProseMirror
before being captured by the `ComposerUpload` setup and its
`preventDefault` call.
2025-04-18 00:20:44 -03:00
492256e91e UX: Welcome bannner and search tweaks for mobile (#32362)
* Hides the welcome banner search in mobile, it's not necessary
  since there is the header search
* Fix an issue where the positioning of the search input for
  the header on mobile was affecting welcome banner search
* Make the welcome font a bit smaller and with less padding so
  it takes up less room on mobile

---------

Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
2025-04-18 12:26:03 +10:00
ec1f43f9ca DEV: Delete old admin page action button component (#32347)
Followup a879bcdc356d4e691fd217abd34a9f9a2022539c
2025-04-18 09:38:12 +10:00
4c26679b2d DEV: fix form template flaky (#32360) 2025-04-17 19:54:38 -03:00
bdca369288 UX: don't decrease composer monospace font on mobile (#32358)
I think this is causing iOS to zoom in on the composer in some
scenarios, and we don't want that:


![image](https://github.com/user-attachments/assets/b4b22d25-c3f8-4da5-91d0-1b1940150a89)
2025-04-17 17:44:52 -04:00
cd805d0d8f DEV: Revert "FIX: Flaky test for FormTemplatesController (#32351)" (#32359)
This reverts commit 4cd7ca677f69a18ab680c4b0ecac4a0d583d533b.
2025-04-17 18:39:26 -03:00
2dac94d99f FIX: remove mixed declarations from header.scs (#32357)
Follow-up to a0eeb83, this fixes the mixed declarations error
2025-04-17 15:43:40 -04:00
a0eeb831d3 REFACTOR: merge mobile/desktop header styles into /common (#32320)
This eliminates the `/mobile` and `/desktop` `header.scss` files and
moves the relevant CSS under `common/header.scss` using `.mobile-view`
and breakpoints.

I was also able to eliminate some redundant and unused styles in the
process and move a couple more general styles to `discourse.scss`
2025-04-17 14:57:28 -04:00
12c5392b38 UX: Header search tweaks (#32354) 2025-04-17 11:32:19 -05:00
fd9d0d11b4 UX: auto focus emoji picker input on mobile (#32353)
Previously this behavior was only on desktop.
2025-04-17 18:03:28 +02:00
4cd7ca677f FIX: Flaky test for FormTemplatesController (#32351) 2025-04-17 10:23:58 -05:00
72f9714ddc FEATURE: Implement tag group selection in dropdown and multi-select for topic creation and preview when using Form Templates (#32108)
Adds support for a tag-chooser in form templates. It supports single tag
and multi tags. The source of the displayed tags has to be a tag_group
name.

---------

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2025-04-17 08:38:03 -05:00
ff334fde8e UX: header search mobile support - follow up (#32306)
### Changes made

#### Styling
1. added `4px` spacing between search input and cancel button
2. increased cancel button size (with padding) to match input height
3. decreased search panel padding by 1/2 from 16px to 8px
4. animation show/hide changed (from vertical to horizontal) and made it
quicker (300ms->200ms)
5. set html unscrollable when search panel is open

#### Dev
1. changed `data-test-` value to be consistent with other element's
attrs values
2. clear search action tag changed from `<a>` to `<DButton>`
2025-04-17 20:01:47 +08:00
918aa0fbec DEV: Add :sidekiq_job_error DiscourseEvent (#32307)
This commit adds a `:sidekiq_job_error` event which is
triggered when an error is encountered while running a Sidekiq job. The
intent of this change is to complement the `:sidekq_job_ran` event which
can be used with the `:sidekiq_job_error` event to calculate the error
rate for each job.
2025-04-17 15:41:58 +08:00
63f7755123 FIX: Unclaim reviewables when finished. (#32346)
When a reviewable is auto-claimed, this actually claims all reviewables in a given topic, rather than just the specific post that the reviewable is about. Particularly for sites that require all posts to be reviewed, this can quickly result in many reviewables being unintentionally claimed by the first moderator to review a post in a given topic.

Unfortunately, due to `ReviewableClaimedTopic` being originally built to claim by topic, we can't fully fix this without significant re-architecture. In the mean time, however, we can ensure that reviewables are unclaimed once they've been handled, so that the next reviewable from a topic won't be automatically claimed.
2025-04-17 16:28:27 +10:00
530f2f13af FIX: Make the 'Keep Message Deleted' reviewable option work (#32345)
When a flagged chat message has already been deleted, we offer an option
in the review queue to agree with the flag and keep the message deleted.
However, this option is currently broken due to a missing implementation
for the option.

Internal topic: t/152203.
2025-04-17 07:35:08 +03:00
a69a304f11 FEATURE: allow edit custom flags (#32344)
Allow admins to edit user custom flags. Because changing
name/description will update name/description for old reviewables,
warning has to be displayed.

Still, system flags can never be edited or deleted (only disabled).
2025-04-17 12:31:52 +08:00
f6eb2e083c DEV: Resolve flaky test due to regexp match (#32343)
The test being fixed in this commit was flaking with the following
error:

```
Capybara::Ambiguous:
  Ambiguous match, found 2 elements matching visible css ".stream-topic-title .title a[href*='/2']"
```

The regexp match on the `href` attribute has the potential to match
multiple elements if both urls contain the `/#{topic.id}` substring. For
example, both `/t/-/2/2` and `/t/-/1/2` will satisfy the regexp.
2025-04-17 09:32:22 +08:00
6028363de2 FIX: Remove hint for browser search shortcut (#32330)
Followup 735bef9ea0d497ae7e04bd4a104bd86e928fc472

Remove the tip in search for users to press Ctrl+F
again to do browser search, as this is no longer relevant
2025-04-17 10:22:40 +10:00
b724181bdf DEV: Update verbiage around remove password modal, swap button for a link (#32338)
Simplified the language around remove password to be more clear, swapped out the button for a link.
2025-04-16 14:37:54 -05:00
3d689bbbc2 DEV: Raise exception for deprecations in core stylesheets (#31894) 2025-04-16 16:36:41 +01:00
fec1ba0d73 DEV: Fix scss deprecation warning (#32325) 2025-04-16 11:34:30 -04:00
cb64b37070 UX: Add visual variation to theme screenshot placeholder (#32077)
This update adds randomized SVG placeholder designs for themes without
screenshots. Each placeholder pulls from the theme’s color palette to
give a better visual hint of what the theme might feel like.

There are a few different styles:
1. Envelope-style gradient – uses `tertiary`, `quaternary`, and
`highlight`
2. Soft blur gradient – uses `tertiary`, `quaternary`, and `highlight`
3. Mesh – uses `tertiary` and `secondary`
4. Layered waves – uses `tertiary`, `quaternary`, `highlight`, `danger`,
and `success`

The style is randomly picked per theme, so the grid looks more varied by
default.

<img width="1109" alt="image"
src="https://github.com/user-attachments/assets/5ede0ecf-a1e4-46c0-9fd2-bee4b6c672c2"
/>


Internal: /t/149935

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2025-04-16 05:21:45 -06:00