Commit Graph

59598 Commits

Author SHA1 Message Date
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
80970f6818 Build(deps-dev): Bump @swc/core from 1.11.31 to 1.12.0 (#33151)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.31 to
1.12.0.
- [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.31...v1.12.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-11 12:40:04 +02:00
f7a2702f2b Build(deps-dev): Bump @discourse/lint-configs from 2.21.0 to 2.22.0 (#33027)
Bumps
[@discourse/lint-configs](https://github.com/discourse/lint-configs)
from 2.21.0 to 2.22.0.
- [Commits](https://github.com/discourse/lint-configs/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-11 20:30:58 +10:00
ebbea74d94 Build(deps): Bump rack from 2.2.13 to 2.2.17 (#33152)
Bumps [rack](https://github.com/rack/rack) from 2.2.13 to 2.2.17.
- [Release notes](https://github.com/rack/rack/releases)
- [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rack/rack/compare/v2.2.13...v2.2.17)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-11 17:22:47 +10: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
829b1bd6fd FIX: Allow setting blank secret on an existing webhook (#33096)
We had a regression where you can no longer update an existing webhook to have a blank secret field.

The problem is the blank field will return a value of undefined, which is ignored by the store when sending the request to the back-end.

This fixes that by using the nullish coalescing operator to replace undefined with an empty string.
2025-06-11 09:53:12 +08:00
c651983877 DEV: Refactor grippie resizer from composer into Modifier (#33046)
This commit takes the dragging behaviour of the grippie
element (the blue bar) at the top of the composer and makes
it into an ember Modifier for use in more places.

The first usage is to add a grippie resizer to the bottom of AceEditor
to followup f819b1ec4dc96e78de075e15df37d114851f785c, since
the `@resizable` option allows the user to vertically resize
the code editor.

Custom composer-related behaviour is now done via callbacks from
the modifier. The .grippie CSS class has been hoisted so the style
applies everywhere, then AceEditor modifies the appearance to blend
a bit better.

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2025-06-11 11:08:11 +10:00
8efee7d875 Revert "DEV: Improve quoted post handling and enhance decorator stability (#33111)" (#33153)
This reverts commit cf9e4dec90884505b6dead93685dc00628e737b1.
2025-06-10 21:49:54 -03:00
cf9e4dec90 DEV: Improve quoted post handling and enhance decorator stability (#33111)
Added `topic` tracking to posts and improved quoted post handling by
linking quoted posts to their parent topic.

Introduced error handling for decorators to prevent crashes and ensure
smoother operation in case of unexpected issues.
2025-06-10 18:32:31 -03:00
25c62b184e Update translations (#33145) 2025-06-10 23:27:48 +02:00
6656443433 DEV: Small fixes and tweaks in the Glimmer Post Stream (#33112)
- Fix displaying the time gap
- Do not display the counter on links with zero posts
- Adjust button padding and icon margin in the post metadata button
indicators (edit)
2025-06-10 17:38:57 -03:00
7faa56cd7c UX: fix-border-radius (#33147) 2025-06-10 13:36:43 -05:00
512a31339a UX: composer toolbar changes (icon, style, placement) (#32918)
Changes the gear icon for the more menu to a circle-plus icon.

Changes the emoji icon to its outline version, to make it less similar
to the circle-plus icon.

Changes the styles (eg. icon sizes) of the toolbar, using a flexbox
instead of a grid, with some tweaks and animations to the toggle switch,
which occupies a smaller width now.

Removes the gray button-bar bottom border.

Moves the Insert Date/Time item to the more menu, and changes its icon
to a clock.

### Before, hovering more menu

<img width="758" alt="image"
src="https://github.com/user-attachments/assets/84d8f5aa-519e-40a2-ba44-d58d7294f6b0"
/>

### After, hovering more menu

![image](https://github.com/user-attachments/assets/b54eac09-9dd0-4b7f-b93c-82d452cc5ded)

---------

Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
2025-06-10 12:16:19 -03:00
0c6dec79e5 DEV: Modify flag:created appEvent trigger (#33133)
## Changes 

This PR modifies `flag:created` appEvent trigger to pass `opts.message`.
2025-06-10 09:57:54 -05: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
7227d714cc Build(deps): Bump core-js from 3.42.0 to 3.43.0 (#33135)
Bumps
[core-js](https://github.com/zloirock/core-js/tree/HEAD/packages/core-js)
from 3.42.0 to 3.43.0.
- [Release notes](https://github.com/zloirock/core-js/releases)
-
[Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/zloirock/core-js/commits/v3.43.0/packages/core-js)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 10:24:12 +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
34b42a9492 DEV: remove redundant composer tips site settings (#33127)
In #33012 we phased out the site settings for:

- disable_avatar_education_message
- sequential_replies_threshold
- warn_reviving_old_topic_age

This change is a follow up migration to delete the site settings from
the database.
2025-06-10 09:15:43 +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
d6f29692ea Build(deps): Bump terser from 5.41.0 to 5.42.0 (#33136)
Bumps [terser](https://github.com/terser/terser) from 5.41.0 to 5.42.0.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.41.0...v5.42.0)

---------

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-06-10 09:13:33 +08:00
8faac814ef Build(deps-dev): Bump rubocop from 1.76.0 to 1.76.1 (#33137)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.76.0 to
1.76.1.
- [Release notes](https://github.com/rubocop/rubocop/releases)
-
[Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop/compare/v1.76.0...v1.76.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 09:13:23 +08:00
527046e2e8 Build(deps): Bump diffy from 3.4.3 to 3.4.4 (#33138)
Bumps [diffy](https://github.com/samg/diffy) from 3.4.3 to 3.4.4.
- [Changelog](https://github.com/samg/diffy/blob/main/CHANGELOG)
- [Commits](https://github.com/samg/diffy/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 09:13:11 +08:00
f8d45d2037 Build(deps-dev): Bump sqlite3 from 2.6.0 to 2.7.0 (#33139)
Bumps [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) from
2.6.0 to 2.7.0.
- [Release
notes](https://github.com/sparklemotion/sqlite3-ruby/releases)
-
[Changelog](https://github.com/sparklemotion/sqlite3-ruby/blob/main/CHANGELOG.md)
-
[Commits](https://github.com/sparklemotion/sqlite3-ruby/compare/v2.6.0...v2.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-10 09:13: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
b35d9641fe DEV: track and cancel timers in the post-stream viewport tracker (#33134)
Introduced a map to manage scheduled/debounced timers, ensuring they are
canceled when the component is destroyed. This improves memory
management and prevents potential issues with lingering timers after
destruction. Updated relevant methods to utilize this new tracking
mechanism.
2025-06-09 20:18:51 -03:00
d304e708be FIX: Stop silently dropping first two rows during load_mapping (#33076)
Currently, the first two rows returned by `DiscourseDB#query_array` are
silently dropped during the column size check in
`DiscourseDB#load_mapping`. This happens because the rows object, while
an enumerator, isn't fully compliant, it doesn't rewind during
introspection. As a result, calls like `#first`, `#peek`, or `#any?`
advance the iterator.

Ideally, we’d fix this by updating the `query_array` enumeration
implementation. However, customizing the enumerator to be fully
compliant would likely introduce unnecessary perf overhead for all use
cases. So, this fix works around that limitation by building the map a
little differently.
2025-06-09 23:26:59 +02:00
b1f5d2e4b9 FIX: Stop blocking auto scroll on iOS (#33129)
Previously on iOS the chat would explicitly not scroll down to the bottom when a new message was added.
2025-06-09 15:00:06 -05:00
773ae006b7 UX: scale down banner (#33132)
Removing some bottom spacing + smaller font-size for mobile
2025-06-09 19:00:53 +02:00
a9cf9aeba1 DEV: Correctly warn about inter-theme/plugin template clashes (#33124)
Followup to d5ddaf05ee7dd03b14ec51564fca654a663aef3a
2025-06-09 17:32:43 +01:00
8f52b81efa FIX: Restore backwards-compatibility of templates/components/*.hbs (#33131)
Non-colocated `.hbs` files in themes and plugins should be treated as
classic components, not glimmer components.

This regressed in cb6cc8dcd339b5036fecfd8ae0301accc7df4ee1

Also adds Ember's `component-template-resolving` deprecation to our list
of deprecations which trigger admin warnings.
2025-06-09 17:30:06 +01: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
c1946425fa FIX: chat: shows placeholder instead of timer for empty chats (#33105)
For empty chats, a dummy message is created with `id=null` (an
unsaved Ember model). 

The timer or placeholder's display is determined by the message ID's presence now (not the `createdAt` prop).
2025-06-09 15:59:04 +08: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
b1d4db17e3 Bump version to v3.5.0.beta7-dev 2025-06-09 12:19:57 +08:00
189e1361e1 Bump version to v3.5.0.beta6 v3.5.0.beta6 beta latest-release 2025-06-09 12:19:56 +08:00
232f220546 UX: add * mention to site setting description 2025-06-09 12:04:15 +08: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
ff1f2ee0a0 FIX: Wrong link to groups in post-small-action widget (#33099) 2025-06-09 09:08:56 +08:00
a12a78dc6d Build(deps): Bump rbtrace from 0.5.1 to 0.5.2 (#33115)
Bumps [rbtrace](https://github.com/tmm1/rbtrace) from 0.5.1 to 0.5.2.
- [Changelog](https://github.com/tmm1/rbtrace/blob/master/CHANGELOG)
- [Commits](https://github.com/tmm1/rbtrace/commits)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-09 09:08:03 +08:00
2d6e24689c Build(deps-dev): Bump rubocop-ast from 1.45.0 to 1.45.1 (#33116)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.45.0
to 1.45.1.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
-
[Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
-
[Commits](https://github.com/rubocop/rubocop-ast/compare/v1.45.0...v1.45.1)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-09 09:07:37 +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
43e41cea44 Build(deps-dev): Bump @swc/core from 1.11.29 to 1.11.31 (#33091)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.11.29 to
1.11.31.
- [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.29...v1.11.31)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-07 17:01:47 +02:00