Commit Graph

1045 Commits

Author SHA1 Message Date
301f27caaa DEV: add shortcut fab!(:variable, :fabricator) to specs (#33577) 2025-07-11 11:16:34 -03:00
afc5d13c63 FEATURE: Text heading/paragraph menu in composer toolbar (#33461)
This PR introduces a heading/paragraph dropdown menu for  the
composer toolbar, that works for both the new rich text editor, and
the old markdown editor.

Features include:

* Dynamically changing the icon based on the heading level
* Checking the current heading level in the dropdown list
* Applying the same heading level to multiple selections

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Renato Atilio <renatoat@gmail.com>
2025-07-11 12:29:58 +10:00
b4a376bd9a DEV: Use reusable d-table instead of admin-only styles (#33531)
Follow up to https://github.com/discourse/discourse/pull/33253

Switches to the generic `d-table` class instead of using the admin
stylesheet. No visual changes, except the badge/status for the API key.

| Before | After |
|--------|--------|
|
![image](https://github.com/user-attachments/assets/e4d1a0ad-8e60-4ad8-b3b1-d17b66b878e8)
|
![image](https://github.com/user-attachments/assets/5bc41353-c4a0-486b-b730-451b9f737341)
|
2025-07-10 19:58:04 -06:00
92c9d43b9a DEV: add additional icon aliases for lock (#33547)
This adds some new icon aliases so the lock icon can be overridden in
specific scenarios without applying globally to all locks:

* "topic.closed"
* "topic.opened"
* "category.restricted"

This enables customizations like:


![image](https://github.com/user-attachments/assets/e7dc62ce-98ed-49ad-b127-97cf928f3371)

```
import { apiInitializer } from "discourse/lib/api";

export default apiInitializer((api) => {
  api.replaceIcon("topic.closed", "xmark");
  api.replaceIcon("category.restricted", "shield-halved");
});
```

More documentation on this feature in
https://meta.discourse.org/t/change-icons-globally/87751
2025-07-10 14:11:03 -04:00
3604aa2bcc DEV: Add a Gravatar enable/disable toggle (#33533)
We want to add the ability to enable/disable users selecting Gravatar for their avatar.

This change adds a site setting to enable/disable the option (default to enabled.) This will prevent users from configuring Gravatars from that point on. It does not affect already configured avatars.

We're also taking this chance to hide some of the advanced settings from the UI.
2025-07-10 15:09:32 +08:00
bccf4e0b53 FIX: improve "read only" modes (#33521)
The reasons for these changes is https://meta.discourse.org/t/-/89605
broke and admins were not able to log back in if they had previously
enabled the "read only" mode.

Thus ensued a deep dive into how all the "read only" modes worked, which
was made difficult due to the lack of tests.

The "cornerstone" of this PR is the `read_only_mixin.rb` file which was
improved to be able to differentiate between the "readonly" mode and the
"staff writes only" mode.

I then made use of the `allow_in_readonly_mode` and
`allow_in_staff_writes_only_mode` method to **explicitely** list all the
actions that should work in those modes.

I also added the "readonly" mixin to the `WebhooksController` since it
doesn't inherit from the `ApplicationController`.

I improved the security of the `/u/admin-login` endpoint by always
sending the same message no matter if we found or not an admin account
with the provided email address.

I added two system specs:

1. for ensuring that admins can log in via /u/admin-lgoin and then
clicking the link in the email they received while the site is in
readonly mode.
2. for ensuring the "staff writes only mode" is _actually_ tested by
ensuring a moderator can log in and create a topic while the site is in
that mode.

Plenty of specs were updated to ensure 100% converage of the various
"read only" modes.
2025-07-10 09:08:00 +02:00
0a62f641d5 FEATURE: Show dialog on translated post to choose to edit original or translated (#33184)
## 🔍 Overview
This update handles how editing post translations should work. It
ensures that when you are viewing a translated post, and try to edit a
post, you are shown a dialog to either edit the original or the
translation.

## 📸 Screenshots
<img width="843" alt="Screenshot 2025-06-24 at 14 49 53"
src="https://github.com/user-attachments/assets/fce82b2f-8c48-4f3b-ae0a-46a6afbf742e"
/>
2025-07-09 10:23:30 -07:00
6bcb38f410 REFACTOR: consolidate empty states, add invite variant (#33455)
This consolidates various empty states to use a single `EmptyState`
component. I've also added a new state when there are no pending
invites.

I've moved the SVGs to stand-alone components in a `components/svg/`
directory. I believe these need to be embedded (rather than separate
`.svg` assets) because we're using color variables within.

Most of the `EmptyState` component is optional so it should be flexible.
An optional tip block is used for when we may need to utilize an action
instead of a link (as invites do).

The invite tip includes a prefix and suffix so translators can adjust as
needed for their locale.


The existing empty states should only change slightly... 

New

![image](https://github.com/user-attachments/assets/e85b38cb-82f9-408c-bca9-d01db1ff2b4e)


Unread

![image](https://github.com/user-attachments/assets/5546b8fa-8645-4568-a155-42155c0f4477)


Chat channels

![image](https://github.com/user-attachments/assets/80efe964-85cf-4054-aa4c-efdb0864b84b)


Plus the new invite state: 

![image](https://github.com/user-attachments/assets/e2708ba4-32e8-4e47-aa99-a712b45922f9)


These simpler empty states are also using the component now, it will now
be easy to enhance these with illustrations in the future as well.


![image](https://github.com/user-attachments/assets/30f8ee5e-7cb4-45f1-9652-bbd5b1c034de)



![image](https://github.com/user-attachments/assets/98e62785-4e1f-40c6-8c86-5f98391472a0)
2025-07-09 12:34:04 -04:00
0a242221fc DEV: Force full refresh from language switcher (#33522)
While topics, posts, and titles had the language switched, controls were
still in the old language. Force a full refresh.

Related: t/157985
2025-07-09 11:17:42 +08:00
4a8d2bdfeb DEV: Fix topic link component for reviewabled flagged post in new UI (#33518)
This commit fixes a problem in the new reviewable item template that
uses the `reviewable-refresh/topic-link` component where a topic is
always shown as deleted even if the topic is present.
2025-07-09 09:11:25 +08:00
bb4755feab FEATURE: image input rule when typing on rich editor (#33498)
Adds a `![markdown](image)` input rule that uses the markdown parser to
create an image node.

Supporting this format surfaced an issue with dimension-less images, so
now the image node view uses the max width/height site settings in
addition to the loaded image natural dimensions to determine what a 100%
looks like – it's used for display, and also when a zoom-out button
action is taken, so we calculate the next step % of the calculated
dimensions.
2025-07-08 15:12:47 -03:00
166aa624ab DEV: Fix PMs user/group removal in the Glimmer Post Stream (#33514)
This commit addresses an issue where the removal of users/groups was targeting the wrong user.

---------

Co-authored-by: Sérgio Saquetim <saquetim@discourse.org>
2025-07-08 14:42:53 -03:00
570031a90f FIX: Badge grouping for system badges should be editable (#33504)
This is mostly a fix for the UI which incorrectly disables the badge
grouping field for system badges. However, nothing in the backend
suggests that the badge grouping for system badges is disallowed. This
is confirmed by the fact that `Badge.protected_system_fields` do not
list the `badge_grouping_id` column as protected.
2025-07-08 10:56:47 +08:00
a24107dd15 FIX: Escape URL when inserting/editing links in composer modal (#33501)
Fixes an issue where a URL like this:

```
https://meta.discourse.org/admin/site_settings/category/all_results?filter=discourse connect
```

Would appear to be broken when inserting into the composer via the
hyperlink modal. All we have to do is escape it before inserting,
and unescape before editing it in the modal.

Also in this commit I am renaming the InsertHyperlink modal to
UpsertHyperlink,
since it is used for both inserting and editing links.
2025-07-08 12:51:25 +10:00
7f5d7611dc FIX: convert invalid mentions in composer rich text mode to text (#33437)
This change makes it easier to edit typos when adding mentions to
composer's rich text mode. Previously we would keep invalid mentions as
mention nodes and use a data attribute to identify if they were valid or
not and style them based on that. This would mean that pressing
backspace would delete the entire mention and you would have to type
again from scratch.

The updated approach is to replace the invalid mention node with text
and in turn removes the need to use the data attribute to identify
valid/invalid mentions.
2025-07-07 20:11:14 +04:00
d07443a721 FEATURE: rich editor image toolbar for scale/alt text/delete (#33381)
Displays a toolbar and the alt text of the image when it's selected.

The toolbar allows changing the scale between 50, 75 and 100 and
deleting the image.

The alt text display can be clicked/focused to open an editable input.



https://github.com/user-attachments/assets/330f5c7c-e29a-46ab-b2cd-e7c7c07c15bf



It also introduces a simple GlimmerNodeView class that serves as a
bridge between ProseMirror NodeViews and Glimmer components, which is
used on this new version of the image node.

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Martin Brennan <martin@discourse.org>
2025-07-07 11:48:54 -03:00
ba64209468 FIX: Sidebar messages link updates (#33444)
* Fixes capitalisation for *My messages*, *My posts*, and *My drafts*
sidebar links.
* Hides *My messages* link for anonymous users.
* Hides *My messages* link for users who can’t access messages.
* Adds active state for *My messages* link (applies to all child routes:
personal, group, and tags).
2025-07-07 11:55:39 +08:00
01d42ab524 FEATURE: Display locale change in post history modal (#33469)
This commit adds locale changes to the post history modal, and also updates
the topic's locale if the first post is being updated.
2025-07-03 23:08:47 +08:00
9cd271ae60 FIX: resets quote state when reseting text selection (#33463)
In the follow cases:
- no text selection
- invalid text selection (outside of the cooked of a post)

The quote state should be cleared. This commit also adds a spec to
prevent similar regressions.
2025-07-03 12:18:10 +02:00
7ee96e398f DEV: Update colors for flag reasons in new reviewable UI (#33462)
Prior to this change, off topic and something else flags did not have
the right CSS classes set resulting in the right colors not being set
for the badges used to display the flag reasons.

This commit also updates the colors used for the off topic and illegal
flags to reflect the severity. Before this change, the badge color for
illegal was green while the badge color for off topic is blue. Those
colors are too "positive".

### Screenshots

#### Before

<img width="718" alt="Screenshot 2025-07-03 at 3 22 49 PM"
src="https://github.com/user-attachments/assets/cc10d078-fe58-41aa-8c15-4bba86eb90e5"
/>

#### After

<img width="715" alt="Screenshot 2025-07-03 at 3 23 02 PM"
src="https://github.com/user-attachments/assets/e039e042-68ae-4e76-bd5a-62116ef020a3"
/>
2025-07-03 15:56:39 +08:00
0ec3fd570d DEV: Add CurrentUserSerializer#use_reviewable_ui_refresh attribute (#33460)
This commit adds a `use_reviewable_ui_refresh` attribute to the
`CurrentUserSerializer` and updates the client side to use this
attribute as a feature flag to determine when the new reviewable UI
should be shown.
2025-07-03 14:54:05 +08:00
ffeec9fb27 Revert "DEV: Introduce reviewable_ui_refresh site setting (#33404)"
This reverts commit bc29e5088eb21b10ce3f3055f9dd961900c75ff7.
2025-07-03 13:31:27 +08:00
5b3347ea93 Revert "DEV: Display flag reasons and count for reviewable in refreshed UI (#33408)"
This reverts commit db49566d901052235d345a56f9d5b1997c0bd9e6.
2025-07-03 13:31:27 +08:00
7dffa06de6 FEAT: Add clipboard button to new palette UI (#33430)
The current colour palette editor has a ‘Copy to clipboard’ button on it
that copies a JSON object of the current palette’s colours. This commit
adds the button to the new colour palette UI.
2025-07-03 08:09:49 +03:00
d1a59f8e08 UX: Improve invite list (#33253)
This PR improves the user invite list for both desktop and mobile views:

* Simplified table layout
  * Better layout on mobile
  * Removes extra padding and header row clutter
  * Better alignment of columns and row spacing
  * Keeps invite details compact but clear

* Improved group display
  * Group icons and names are now properly aligned side-by-side
  * Consistent inline styling for multiple groups per invite

* Updated row actions
  * Moves the Remove action into a dropdown to reduce accidental clicks and keep destructive actions less prominent
  * Uses consistent button styling (Edit and More actions)
2025-07-03 09:28:02 +08:00
ebee4df8a1 DEV: Replace toolbar popup menu with DMenu (#33247)
This commit replaces the `toolbar-popup-menu-options`, which used
`select-kit` with a new implementation using `dmenu`.

---------

Co-authored-by: Renato Atilio <renato@discourse.org>
Co-authored-by: Martin Brennan <martin@discourse.org>
2025-07-03 09:57:16 +10:00
db49566d90 DEV: Display flag reasons and count for reviewable in refreshed UI (#33408)
This commit adds a header with badges indicating why a reviewable was
created in the refreshed reviewable UI that is currently being hidden
behind the `reviewable_ui_refresh` site setting.

Co-authored-by: Gary <gary@pento.net>
2025-07-02 13:34:31 +08:00
b47b167b40 FIX: Ensure client-side reviewable claiming data is set correctly (#33405)
`ReviewableClaimedTopic` has an `onClaim` arg, which is used by the calling components to locally mutate the value of `reviewable.claimed_by`.

This was being incorrectly mutated to a `User` model, when it needs to match the `ReviewableClaimedTopicSerializer` output.
2025-07-02 14:22:23 +10:00
f40834a679 UI: improvement for the admin system theme (#33406)
List of small changes for the system Horizon theme:
- Remove"Created by: system"
- Remove All Extra Files section
- Move translation to core
- Remove settings editor button
- Remove export button
2025-07-02 10:57:09 +08:00
863620a948 FIX: Show tip for required selectable field on signup when not selected (#33401)
Dropdown and multiselect components lack `InputTip`, which makes them
not show any reason when validation fails.

This commit also adds a new i18n message for select fields, after this
commit, if a multiselect or dropdown custom field required has no option
selected, it will display a `Please select a value for "XX" field`
validation error when the Signup button is clicked.
2025-07-02 09:54:23 +08:00
8ffc9dcb70 FIX: UppyUploader issues when authorized_extensions setting is blank but authorized_extensions_for_staff is not (#33423)
**Problem**
An error is showing up for staff members when trying to upload images
and `SiteSetting.authorized_extensions = ""` and
`SiteSetting.authorized_extensions_for_staff != ""` because
`this.currentUser` is not defined in the `UppyUploader` component
2025-07-01 18:39:47 -05:00
bc29e5088e DEV: Introduce reviewable_ui_refresh site setting (#33404)
This commit introduces an experimental `reviewable_ui_refresh` site
setting of `group_list` type. When a user is part of any group
configured in the site setting, the new reviewable UI will be shown to
the user.

Co-authored-by: Gary <gary@pento.net>
2025-07-01 15:31:26 +08:00
eef0b47b43 DEV: Fix broken test (#33403)
Follow-up to 40256ecc1c583f41346321654536feed6cd21f27
2025-07-01 12:56:19 +08:00
d61309bb6f UX: adds optional subheader to welcome banner (#33361)
Adds support of an optional subheader to the core welcome banner.

Similarly to header it accepts `logged in` and `anonymous` copies.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-07-01 10:03:16 +08:00
b20d6792bf FEATURE: Add a hidden setting to limit number of content localization locales (#33378)
We want to add a hidden limit to the number of locales an admin can set
for localization. This is a safe limit to prevent excessive localization
(if each post can be localized to 10 locales, that's 10x the amount of
storage and tokens needed).


t/157677
2025-06-30 15:29:58 +08:00
de5d29c7ff DEV: Add support for textarea form fields in FormKit page object (#33382)
At the moment, the `value` method doesn't work for textareas. This adds
support :)
2025-06-27 18:31:43 -05:00
f1e9723e96 FIX: Unclaim reviewables when an action modal is cancelled. (#33377)
When a modal is opened as part of a reviewable action, we automatically mark a reviewable as claimed, so that other site staff won't accidentally start working on that reviewable. If the modal is cancelled out of, however, we weren't removing the claimed flag.
2025-06-27 16:16:37 +10:00
Sam
d9174e7435 FIX: add missing last read sort order to full page search (#33376)
- Also fixes alias resolution
2025-06-27 14:30:59 +10:00
00c97178d5 FIX: Don't allow submitting bulk topic actions without a notification… (#33292)
… level

See report https://meta.discourse.org/t/-/371074

---------

Co-authored-by: Blake Erickson <blake@discourse.org>
2025-06-25 14:48:36 -06:00
22093826d7 FIX: Make theme relative selectors save (#33344)
The parent component of `ThemeSettingRelativesSelectorComponent`,
`SiteSettingComponent`, has recently been migrated from being a legacy
component to a Glimmer component (in
https://github.com/discourse/discourse/pull/33255), but we missed
updating the child class to use Glimmer's patterns, namely how arguments
are accessed in Glimmer components (`this.args.foo` vs `this.foo`).
2025-06-25 14:06:13 +03:00
c74366c595 UX: display active state on rich editor toolbar (#33296)
Highlights the active formatting state in the toolbar based on the
current cursor position/selection.


![image](https://github.com/user-attachments/assets/383d71c1-bf42-4353-b16b-bf16ae3b321f)

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2025-06-25 06:50:00 -03:00
a6d3597758 FIX: Return the post's raw when GET /post (#33325)
Previously, there was no way to edit post localizations, so the
`post.raw` was always returning the localized value. With localization
UI and endpoints now, we want to always return the original raw and the
composer to reflect the original value.

https://github.com/discourse/discourse/pull/33184 will handle the
decision to show the post edit composer or the post localization
composer.
2025-06-24 22:11:02 +08:00
f69dbcd2c1 FIX: Make Ctrl+K shortcut work consistently in RTE, and not always show chat channel switcher
Followup fb7fa2902cf685ee9d4002e5448b4817f2dbef98,
prevent opening the chat channel selector with Ctrl/Meta+K
in any inputs except the chat composer, most of the time you
do not want this, but especially in the topic composer.

In that case, you want the link insert modal to open.
2025-06-24 12:20:00 +10:00
4cf4225f3d DEV: Introduce state handling for post cooked HTML decorators (#33200)
This PR introduces explicit state management for decorators as part of
the quote controls refactor. The legacy quote controls logic has been
migrated to a new Glimmer component, and state handling for decorator
functions associated with post content rendering is now formalized and
standardized.

### Key Points

- **Decorator State Introduction:**  
- Introduces explicit state objects for use within post and cooked-html
decorators, replacing previous ad-hoc or implicit state tracking.
- Uses `TrackedMap` for state management, improving reactivity and
ensuring consistent, predictable updates when decorator state changes.

- **Component Refactor:**  
- The quote controls logic is now fully encapsulated in a Glimmer
component, leveraging the new decorator state handling for cleaner, more
maintainable code.
  - Legacy implementations have been removed to reduce technical debt.

- **Context and Data Handling:**  
- Decorators and components now receive state and context as explicit
parameters, standardizing the interface and improving code readability.
- Direct properties (such as `post`, `highlightTerm`, and
`ignoredUsers`) replace the previous `data` object, simplifying context
management.

- **Other Improvements:**  
  - Enhanced error handling for async content.
- Improved extensibility by supporting custom wrapper elements in quoted
content.
  - Added functionality to highlight original quoted text.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-06-23 18:13:49 -03:00
d81faa1226 FIX: Do not set locale when replying and also default to none (#33312)
This PR relates to the locale setting in the composer and fixes 2
quirks:
- When replying to a post, the composer sets the locale of the new post
in composer to the locale of the post being replied. This PR defaults
the value to "none"
- When creating a new post, the composer sets the locale to the user's
locale. However we are seeing the behaviour that users do not write in
the locale they set their profile to. This PR defaults the value to
"none"
2025-06-23 21:11:03 +08:00
9dadc0141c FEATURE: add link to "associated accounts" providers (#33275)
This adds a link for each authentication providers that are listed in
/my/preferences/account in the "Associated Accounts" section.

This is particularly useful when Discourse is being used in the PWA or
in the DiscourseMobile app where there's no browser bar available and
the only way to visit the provider's website is to open a browser
window.

That way, they can _just_ click the provider's name.

Internal ref - t/156255

---

**BEFORE**

![Screenshot 2025-06-19 at 21 04
46](https://github.com/user-attachments/assets/3d2be5d0-d857-4b8a-b0a5-5672301c59c6)

**AFTER**

![Screenshot 2025-06-19 at 21 03
39](https://github.com/user-attachments/assets/4c8bc5e9-3c99-4924-8d33-547f567bb346)
2025-06-20 10:22:29 +02:00
30b0e38877 FEATURE: Add revamped new and unread topic filter education (#32669)
This commit improves the empty states and education
for the new and unread pages, so they are less overwhelming
and more visually pleasant.
2025-06-20 11:24:07 +10:00
fe30ffa3f9 DEV: Remove 'experimental' prefix from settings (#33233)
This PR takes the localization features out of "experimental" to prep
for the announcement
- rename settings and gives them its own area
- `experimental_content_localization` to `content_localization_enabled`
- `experimental_content_localization_allowed_groups` to
`content_localization_allowed_groups`
- `experimental_content_localization_supported_locales` to
`content_localization_supported_locales`
- `experimental_anon_language_switcher` to
`content_localization_anon_language_switcher`
- migration
- related to https://github.com/discourse/discourse-ai/pull/1439

| screenshot 📸 |
|---|
| <img width="964" alt="Screenshot 2025-06-17 at 5 06 32 PM"
src="https://github.com/user-attachments/assets/9a8b2c38-c846-4fc9-8ddd-815c45cc3d0e"
/> |
2025-06-19 12:23:42 +08:00
d45ebd746c DEV: Add Discourse ID authenticator (#33186)
Adds a Discourse ID authenticator. Not available for use in production
just yet, but soon communities will be able to use this service to let
users authenticate using a central Discourse ID account.

Includes a support for a `/revoke` action, allowing users to log out of
multiple client instances from a central auth service.

Internal ticket: t/155397
---------

Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-06-17 09:47:00 -04:00
2362bf740d UX: strip base url and https/mailto protocol from link toolbar (#33228)
Strips the site's base URL and `https`/`mailto` protocols from the link
toolbar display


![image](https://github.com/user-attachments/assets/9a38c840-63bb-4a74-a210-f66dd56766cf)

Refactors the toolbar to use getters instead of function calls, re-uses
`DButton` for the `href` toolbar item instead of a custom `a` tag, fixes
a bug where we passed a translated string to DButton's `label` that
expects a i18n key, and adds support to “disabled” buttons.

Slightly simplifies the toolbar implementation by extracting one step of
indirection removing `toolbarButton` from d-editor.
2025-06-17 10:41:19 -03:00