Commit Graph

13174 Commits

Author SHA1 Message Date
862116a176 FEATURE: Add description to invites (#33207)
Add the ability to attach a description to an invite for easier organization.
2025-06-16 11:31:07 +08:00
290b435a72 FIX: Admin can edit the name even if enable_names is disabled (#33170)
There is a bug that when `SiteSetting.enable_names` is disabled, the
admin can click the pencil next to the user and successfully update the
name. However, the change is not saved as the action is blocked by the
guardian.

Meta:
https://meta.discourse.org/t/disabling-enable-names-makes-admin-act-strange/291912
2025-06-16 09:24:17 +08:00
fb7fa2902c UX: suppress chat's Mod-K on rich editor (#33206) 2025-06-14 09:58:59 -03:00
15ec15f2a5 UX: display URL on rich editor link toolbar (#33188)
Works better with changes from
https://github.com/discourse/discourse/pull/33187


![image](https://github.com/user-attachments/assets/cc69b796-6a2a-4461-b52b-bf9d94b43f06)


![image](https://github.com/user-attachments/assets/002a119f-3a18-41a3-8905-c0f461833c17)
2025-06-13 18:03:17 -03:00
bc4844cb93 FEATURE: allow date-based filters to accept a day count (#33197)
This allows date based filters to use a count of days as well as the
existing date string system (`YYYY-MM-DD`). This is convenient if you
want a dynamic list based on the current date, you could use:
`created-after:7` to return topics from the past week.

This will work for: 

 - created-before/after
 - activity-before/after
 - latest-post-before/after
 
This also makes filters consistent with our existing query params like
`?before=7`



This came up in:
https://meta.discourse.org/t/creating-a-custom-filter-homepage/370062
and is something that we mentioned internally while defining our domain
specific language for the /filter route, but never implemented.
2025-06-13 13:45:50 -04:00
5c932410ba FEATURE: sharing link to PWA renders url in title in new Topic to leverage core link expansion (#32631)
Discourse has a fantastic feature whereby when installed as PWA (on
Android or Windows), you can share content to that Discourse from other
apps and browsers.

Currently when sharing a link to a Discourse PWA, it pre-populates a
draft Topic body with the link.

Whilst this is really nice already, we can improve this further.
Currently, sharing a link to the body misses out on the auto-magic core
feature of pasting a link in the title which simultaneously hydrates a
title from the og tag and creates a one-box in the body.

This PR remedies this whilst carefully maintaining the current behaviour
for text shares.

Documentation for the standard is here:


https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/How_to/Share_data_between_apps

Demo of this working change is implemented in this plugin:

https://github.com/merefield/discourse-share-to-link-oneboxer

I added a test to check presence of share target in manifest endpoint.
2025-06-13 11:25:13 -03:00
19c1932144 Revert "FIX: import Horizon system theme" (#33196)
Reverts discourse/discourse#33193
2025-06-13 14:32:45 +01:00
7562bc2b15 FIX: import Horizon system theme (#33193)
System themes were introduced here -
https://github.com/discourse/discourse/pull/32681

In this PR, Horizon is imported.
2025-06-13 12:30:34 +08:00
2536768a43 FEATURE: system themes (#32681)
Introduction of system themes.  System themes are local themes which:
- Cannot be deleted;
- Cannot have “custom code” added, components only;
- Cannot have uploads;
- Cannot edit color palettes;
- Are updated on deploy, like core plugins.

This PR added the Foundation system theme, which is an empty theme like
Default. The Foundation theme will be added in the next PR.

In a development environment, when system theme files are
changed/added/deleted, the theme is reuploaded and the page is reloaded
to make it a good experience for the engineer working on improvements.

System themes are not visible until
`SiteSetting.experimental_system_theme` is enabled.
2025-06-13 10:36:31 +08:00
c6d926eee7 FEATURE: Clear bookmark reminders from bookmark menu (#33168)
This commit adds a new option in the bookmark menu for existing
bookmarks that allows users to clear the bookmark reminder without
having to delete the bookmark or edit it manually.
2025-06-13 10:37:08 +10:00
fbe754108f DEV: Try fix flaky search shortcut variation test (#33169)
We weren't checking for visibility enough before scrolling
I think
2025-06-13 10:06:54 +10:00
bd6cf79447 Revert "FIX: improves text selection of posts (#33143)" (#33190)
This reverts commit 876dbe66299a7f0d3df71ae9064890a79d228321.
2025-06-13 01:10:25 +02:00
7a9045fa86 DEV: Refactor flakey post stream spec (#33182)
Reorganized the post reply and edit test to mitigate flakiness
2025-06-12 19:26:49 -03:00
0607c47597 DEV: Improvements to post language selector (#33178)
## 🔍 Overview
Sometimes users may overlook that there is a post translations selector
when writing posts. This could lead to the site's default locale being
used when a post is written in the user's preferred language.

This update ensures that:
- the user's `effective_locale` is used as the default for the
`PostLanguageSelector` in the composer
- when the user's `effective_locale` is not one of the
`experimental_content_localization_supported_locales`, we default to
blank so that the `post.locale` doesn't get set
- we also allow for setting a "none" option in the language selector for
cases where the user wants to post in a language that is not part of
`experimental_content_localization_supported_locales`

## 📷 Screenshots
<img width="216" alt="Screenshot 2025-06-12 at 07 03 56"
src="https://github.com/user-attachments/assets/651b9387-de57-408f-9445-92501bd47567"
/>
2025-06-12 08:10:57 -07:00
876dbe6629 FIX: improves text selection of posts (#33143)
This commit is applying different techniques to make selecting text of a
post less error prone:
- ensure we only ever show the toolbar when the common ancestor of a
range is cooked
- ensures the menu is not interfering with text selection
- do not compute the menu while selection is changing, only when pointer
is released

The situation was very bad on android but it should also improve other
situations.
2025-06-12 15:06:24 +02:00
e39c7b4cbb DEV: Add Plugin modifier for reviewable creation (bot posts) (#33161)
I need reviewables to be created for bot users in a private plugin. This
allows me to do that.
2025-06-11 14:57:33 -05:00
5314b6aa82 DEV: Improve quoted post handling and enhance decorator stability (#33154) 2025-06-11 16:38:19 -03:00
4d380a28e7 FEATURE: Add post language on creating a new post (#33160)
This is a second attempt at:
https://github.com/discourse/discourse/pull/33001

We had to [revert the
commit](https://github.com/discourse/discourse/pull/33157) because it
was performing a site-setting check at boot time, which is prone to
issues and not allowed.

This PR:
- re-introduces the changes in the original PR
- a fix by not performing a site-setting check at boot time (verified
by: `SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB="nonexist" bin/rails runner
"puts 'booted'"` locally and should be caught by the new CI check
introduced here: https://github.com/discourse/discourse/pull/33158)
- adds a fix to the translation editor to not show the original post
locale in the dropdown, as well as adding an indicator of what the
original post locale is in a small badge in the header:
- ![Screenshot 2025-06-11 at 08 42
36](https://github.com/user-attachments/assets/5f0944c5-ec4d-40b3-b97f-25b1fcab8329)
2025-06-11 10:39:01 -07:00
d5b72a54ae Revert "FEATURE: Add post language on creating a new post (#33001)" (#33157)
This reverts commit b55af383f779d01d983a3ccf1149438aee9c6725.
2025-06-11 08:01:56 -07:00
b55af383f7 FEATURE: Add post language on creating a new post (#33001)
## 🔍 Overview
Previously we added the ability to translate existing posts in different
languages: https://github.com/discourse/discourse/pull/32564. In this
update we add the ability to set a post language upon initially creating
a post.

Internally, we also clean-up/improve a few things, like:
- adding a `PostLanguageSelector` component
- Adding a `available_content_localization_locales` onto `SiteSetting`
so it's available in the service (without needing to parse the JSON to
access it)
- fix issues with the translation-editor not working due to some
regressions from here: https://github.com/discourse/discourse/pull/32869
- ensure everything works for replies/drafts/edits

## 📷 Screenshots
![Screenshot 2025-06-05 at 12 03
24](https://github.com/user-attachments/assets/ff334575-ba30-4c52-9e9a-4054f69795ec)
2025-06-11 07:29:05 -07:00
1f2efa7954 FEATURE: Add utilities for importing and exporting backups (#32992)
This commit introduces new features and utilities related to the backup
and restore system that make use of remote URLs:

- `discourse restore` accepts a URL to a backup file

- `discourse backup_url` generates a URL of a backup file (S3 only)

- `discourse import_backup_url` downloads a backup file from a URL to
the configured backup store

This can be used to move content between two Discourse instances by
backing up the entire site, copying the backup URL, importing or
restoring it on the other instance.
2025-06-11 15:44:10 +03:00
fd4890b5d3 FEATURE: rich editor link ui for editing it (#32583) 2025-06-11 08:51:27 -03:00
976886ab7c FEATURE: Indicate if a localization might be outdated based on version number (#33148)
We will not update localization on every edit for now. To compensate,
the existing indicator will also add information if a translation might
be outdated.

Related: https://github.com/discourse/discourse-ai/pull/1422

/t/156185
2025-06-11 11:04:05 +08:00
cbffbee1c3 DEV: allows to set timezone and color scheme (#33144)
As defined in: https://playwright.dev/docs/emulation

Example:

```ruby
context "xxxx", color_scheme: "dark", timezone: "Australia/Brisbane" do
  # ...
end
```
2025-06-10 16:09:27 +02:00
af0a65eefd FEATURE: Validate Mentions in Rich Text Editor (#32879)
This change validates mentions for `users` and `groups` when using the
rich text editor.

When the mention is valid (ie. the user or group exists) it will
visually show as a mention node, but when the user or group does not
exist then it will appear as regular text in the editor.

There are 2 parts to this:

### Existing drafts / toggling from Markdown to Rich Text

We automatically add mention nodes for all `@mentions` and then process
any invalid mentions by removing the mention node and replacing it with
text.

### When manually typing in Rich Text

We find the mention within the text and then if valid we replace it with
a mention node.

### Validation

The validation happens in a single request when loading a draft or
switching from Markdown to Rich Text. The response provides a list of
valid usernames and groups. It also provides additional context for
groups and users that are not reachable (ie. unmentionable groups or
suspended users etc) but we don't use this currently.

We then store the valid and invalid mentions to prevent unnecessary
requests later.

As new mentions are typed then they will also be validated using the
same request as above (if they are not already stored in our valid /
invalid sets).
2025-06-10 11:37:20 +04:00
30edefb645 DEV: Remove migration specs (#33142)
Migration specs are useful during code review but provides very
little value after the migration has been executed widely.
2025-06-10 10:52:00 +08:00
f057866070 FEATURE: Add X-Discourse-Sender Header to outgoing mail (#33123)
When there is a relevant `username` associated with an outgoing email,
like in the case of post notifications, the `X-Discourse-Sender` header
will be added to the email, indicating the sender's username.

This mimics the `X-GitHub-Sender` header used by GitHub, which is useful
for filtering and categorizing emails based on the sender.
2025-06-10 10:45:31 +10:00
06e0c6fa6a FIX: Clicking send invites and export button on admin users page (#33121)
The actions are defined on the `AdminUsersIndexRoute` when it should be
the `AdminUsersRoute` as the action is called from the `admin/users`
template.
2025-06-10 08:44:43 +08:00
8074c8dadd FIX: Moment locale loading in type=module (#33128)
The moment locale files expect `this.` to be the window object. In a
type=module, `this` is `undefined`. This commit wraps the
moment-timezone definitions in an IIFE to resolve that.

Also adds a system spec to prevent future moment-timezone regressions.

Followup to a2b0c193dff40278c0a93995cc9b97b05dc8abb2
2025-06-09 14:20:04 +01:00
a2b0c193df DEV: Switch to type="module" for translation files (#33126)
We will be moving towards `type="module"` for all of Discourse's JS
bundles in the near future. This commit makes a start by applying the
change to translation bundles.

This was previously merged, but the lack of `apply_cdn_headers` on the
locales controller led to CORS errors on sites with CDNs.
2025-06-09 13:13:42 +01:00
c28353b0dd Revert "DEV: Switch to type="module" for translation files (#33107)" (#33125)
This reverts commit 33dc48b0daa0f6f75e6c0533edbe3f5df991c694.
2025-06-09 18:06:31 +08:00
33dc48b0da DEV: Switch to type="module" for translation files (#33107)
We will be moving towards `type="module"` for all of Discourse's JS
bundles in the near future. This commit makes a start by applying the
change to translation bundles.
2025-06-09 10:30:16 +01:00
27227c9ece DEV: Simplify CORS logic for public asset routes (#33106)
Previously we would check the request for a matching CDN hostname before
applying the `Access-Control-Allow-Origin` header. That logic requires
the CDN to include its public-facing hostname in the `Host` header,
which is not always the case.

Since we are only running this `apply_cdn_headers` before_action on
publicly-accessible asset routes, we can simplify things so that the
`Access-Control-Allow-Origin: *` header is always included. That will
make CDN config requirements much more relaxed.

At the moment, this is primarily relevant to the HighlightJsController
routes, which are loaded using native JS `type=module`. But in the near
future, we plan to expand our use of `type=module` to more critical JS
assets like translations and themes.

Also drops the `Access-Control-Allow-Methods` header from these
responses. That isn't needed for `GET` and `HEAD` requests.
2025-06-09 08:58:27 +01:00
aa6d0bb685 SECURITY: Respect max length in bot-human PMs
…and work around long-url parsing issue.
2025-06-09 12:04:11 +08:00
Nat
72e224b762 SECURITY: Escape topic title for mailers 2025-06-09 12:04:06 +08:00
0971556058 FIX: Do not show header search icon if welcome banner search shown (#33098)
This brings the search_icon header search mode to parity with the
search_field mode. We don't want to show either of these if the welcome
banner is showing, since it has a search field, this is redundant.

If you scroll the page and the welcome banner is hidden, then we
show the header search icon.

This commit also cleans up some code related to the page-search
shortcut, which we no longer use, including limiting showing search
on topic only if there are > 20 posts.
2025-06-09 09:17:13 +10:00
c8c9504486 DEV: Have about page extra groups depend on groups selected (#33095)
When we ported over the about page extra groups theme component, we used a hidden site setting to control this as per MO.

We don't need this any more. We can simply rely on the presence of any configured groups to decide.
2025-06-06 11:25:59 +08:00
efd01c18cf DEV: Modernize the remaining of the post stream to Glimmer components (#32653)
Co-authored-by: David Taylor <david@taylorhq.com>
2025-06-05 19:48:29 -03:00
10f45a0efe DEV: Skip flaky system tests (#33084) 2025-06-05 16:10:02 +08:00
60a3fe41d2 FIX: Disallow encoded words in e-mail addresses (#33083)
RFC 5322 allows special characters, including ? and =, to be used in e-mail addresses.

RFC 2047 is an extension that adds a feature called "encoded words" which let you embed different encodings in the same header. However, it explicitly says that these aren't allowed in e-mail address headers.

Encoded words have the format:

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="
Where encoding is either Q or B, but could take on other values in the future.

After this change we consider e-mail addresses with an encoded word inside invalid.
2025-06-05 12:58:01 +08:00
12811524fe DEV: Support 'cors origins' site setting for message-bus (#33066)
Discourse message-bus traffic is not considered a 'public api' for
general consumption. However, it does make sense to have consistency
with the CORS behavior of the rest of the app, so that people can use it
at their own risk.
2025-06-04 14:22:15 +01:00
1633d7788a UX: keep marks when using emoji input rules on rich editor (#33058)
When typing `:emoji:` or `:)` to create emoji nodes through ProseMirror
inputrules, this PR changes the handler to enforce the use of the
existing marks in the current caret position (if it's a link, bold, etc)
so the newly created emoji is marked with the same marks(s).
2025-06-04 07:18:47 -03:00
7fce724089 FEATURE: Theme-owned color palettes (#32795)
This commit removes the color palette dropdown from the theme page and replaces it with a new "Colors" tab where the theme's color palette can be edited directly in that tab on the theme page. With this change, a theme's color palette is strongly tied to its theme and can't be linked to other themes and it can't be selected by users without using the theme as well.

All of the changes are behind a feature flag. To enable it, turn on the `use_overhauled_theme_color_palette` setting.

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-06-04 07:47:58 +03:00
a5d6e6ae4d FIX: Respect category/tag filtering for reviewable webhooks (#33051)
Currently, if you configure a webhook with reviewable events and apply
categories/tags filtering, no webhook gets fired for reviewable events.
This is because when we schedule the `EmitWebHookEvent` job, we don't
pass to it the reviewable's category or tags, making it seem like the
reviewable doesn't belong to the filtering category/tags that webhook
specifies.
2025-06-04 10:42:23 +08:00
4e4ff41d19 FIX: latest duplicated groups to about components (#33003)
When "Add Groups to About" component is duplicated, choose the most
recently updated settings for migration.
2025-06-04 09:48:18 +08:00
727bd5dcfb UX: Add subheader to admin themes page (#32987)
Add subheader with install button to match the Components tab.

Remove the "special" card with the install button from the end of the list.
2025-06-04 09:43:55 +08:00
1ba8c0dcdc FIX: Back to themes page not working when theme has enabled components (#33048) 2025-06-04 08:59:50 +08:00
599404de31 DEV: Add a ReviewableNote model, and tie it into the Reviewable model. (#33047)
As part of the review queue refresh, we'll be adding the ability for moderators to make notes on individual reviewable items. As a first step, this change adds the new model and associated backend code.
2025-06-04 09:33:02 +10:00
88ce76bd16 DEV: Added the ability to use users' names in group mention notifications and mentions shown in emails (#33055)
**Description**
These changes were introduced in a previous PR but were reverted due to
a bug when several users were mentioned in a response. This PR
reintroduces the changes along with a fix to the issue.

This is part of a series of changes to allow customers to display users'
names instead of the user's username.

When a user belongs to a group that has been mentioned by another user.
It shows the name of the user that mentioned the group.

[Previous
commit](e147d2afe6)

**Before**


![imagen](https://github.com/user-attachments/assets/b62224fb-9b69-4603-be00-e7aa61d9b33c)

**After**


![imagen](https://github.com/user-attachments/assets/8495cb63-6530-4d86-a51c-f0510d48f6c7)

When a email is sent to the user when mentioned in a post 

**Before**



![imagen](https://github.com/user-attachments/assets/94e674da-085a-41cb-8145-ba6fbe3636ce)

**After**


![imagen](https://github.com/user-attachments/assets/490cb365-bf85-4745-93b9-e47048b2f02e)
2025-06-03 15:49:55 -05:00
8873a33b7a FIX: uses text selection when using hide details (#33049)
When hiding details if the user has currently a text selection we want
to use it as the content of the details element.

/t/-/154716/30
2025-06-03 19:53:45 +02:00