Commit Graph
4485 Commits
Author SHA1 Message Date
Joffrey JAFFEUX c33c0f6019 FIX: ensures user can DM to show start new dm button (#35440)
Followup to https://github.com/discourse/discourse/pull/34820 which
didn't take this case into consideration.
2025-10-16 12:43:09 +02:00
David BattersbyandMartin Brennan b671166ab1 FEATURE: Experimental Photoswipe Lightbox (#35109)
Our current implementation of lightbox uses Magnific Popup, which is now
deprecated and will only receive critical/security bug fixes. Magnific
also relies on jQuery, which we would like to remove where possible
throughout our codebase.

After looking at various options, the general consensus was that
PhotoSwipe was a close match to what we need.

Regular image types that are supported with our current lightbox (jpg,
png etc) will work with their existing cooked markup (no need to rebake
posts). This PR also adds support for SVG images and markup from various
theme components (ie. Discourse Mermaid).

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-10-16 12:24:11 +04:00
Ted Johansson 0dcc602d3c FIX: Broken reviewable link to relevant automation (#35434)
The link to the automation is broken. Probably since we moved discourse-automation into core.
2025-10-16 13:04:42 +08:00
Kelv daac912405 DEV: add api docs for discourse-calendar events index endpoint (#35400)
This creates an overriding `rswag:specs:swaggerize` rake task that also
adds plugin paths, and updates spec helpers to handle plugin paths.

Also adds the spec files for the discourse-calendar events index
endpoint.

### Testing

Running `rake rswag:specs:swaggerize` now generates the same
`openapi/openapi.yaml` file, with `/discourse-post-event/events.ics` and
`/discourse-post-event/events.json` GET documentation.
2025-10-16 07:39:08 +08:00
Chris Alberti 56aef84ac4 FEATURE: Add settings for connect/revoke capability in Login with Amazon (#35387)
Previously manual user connect/revoke in preferences were both enabled
permanently based on the default values in the ManagedAuthenticator
class. This adds settings so either one can be explicitly disabled.
2025-10-15 12:28:20 -05:00
Renato Atilio 2702b73e58 FEATURE: enforce prosemirror-gapcursor on additional block nodes (#35415)
Enforces the gap cursor using the new `createGapCursor: true` node spec
prop to the following block nodes:
- `blockquote`
- `quote`
- `code_block`
- `html_block`
- `spoiler`
2025-10-15 10:14:26 -03:00
Discourse Translator Bot a70793eb07 Update translations (#35316) 2025-10-15 12:05:55 +02:00
Gary Pendergast e0cb29ed4c DEV: Improve validity checking of JSON param values. (#35401)
The validity checking for parameter values being passed in expects them
all to be strings, then casts them to their appropriate type after
confirming that they're valid.

Rather than bypassing these checks, it's safer to convert the values to
strings, then continue with the existing validity checks.
2025-10-15 14:31:12 +11:00
David Taylor 6247fdc255 DEV: Resolve 'unknown OID' warnings for pgvector columns (#35393)
ActiveRecord prints these warnings when loading the db schema into its
internal cache. We don't need to do this for the AI embeddings tables,
since we don't use ActiveRecord models for them.

Reverts the system-spec-specific workaround from 446ff04e
2025-10-14 22:30:06 +01:00
David Taylor 613cf3f969 DEV: Normalize discourse-cakeday route/controller/template names (#35391)
See 6081bc2249 for context
2025-10-14 21:45:13 +01:00
Rafael dos Santos Silva 70ece55d97 FEATURE: Support for newer Gemini Embedding model (#35390) 2025-10-14 17:13:22 -03:00
Rafael dos Santos Silva 78ae5dbc46 FIX: Handle nil @post in CookedProcessorMixin for chat messages (#35386)
Chat::MessageProcessor includes CookedProcessorMixin but only sets
@model, leaving @post as nil. The process_hotlinked_image method was
attempting to access @post.post_hotlinked_media, causing undefined
method errors when processing chat messages with images.
2025-10-14 16:04:25 -03:00
Keegan George 51f323ef37 DEV: Allow seeded models in enumerator (#35385)
With out AI credit system being rolled out, we no longer rely on
allowing/disallowing seeded models in the enumerator. This update allows
seeded models to be selected and used in the `LlmEnumerator`.
2025-10-14 11:05:33 -07:00
Kris 18f9bf787a A11Y: add role to video thumbnail button (#35326)
We markup video thumbnail `div`s in posts with `tabindex="0"` which
makes them tabbable, but without a role it's unclear they're
interactive.

Since on click or keypress these play the video, it should have
`role="button"` as well as an an accessible label.

I also noticed that `onKeyPress` was added here but isn't wired up to
anything... so I've included that and also added the space key as a
trigger in addition to enter.
2025-10-14 11:51:51 -04:00
Keegan George 902fd7494b FEATURE: Hosted LLM credit system (#35162)
## 🔍 Overview
This update adds a credit system under the hood which will be used for
our CDCK Hosted LLM models so we can make our features more accessible
to our hosted customers!

## 📷 Screenshots
<img width="1105" height="268" alt="Screenshot 2025-10-02 at 12 48 58"
src="https://github.com/user-attachments/assets/2a07d89b-7510-4565-82bb-26b46fbcf5c4"
/>

_☝🏽 ` ProblemCheck` notices to inform customers_

<img width="1077" height="472" alt="Screenshot 2025-10-02 at 12 49 41"
src="https://github.com/user-attachments/assets/b72028f7-5df2-45a8-8c71-65cf750755ab"
/>

_☝🏽 AI Usage page for easy monitoring_

<img width="1112" height="1083" alt="Screenshot 2025-10-02 at 18 17 01"
src="https://github.com/user-attachments/assets/a01992d5-15a0-472a-9501-bc3bc9a54ade"
/>

_☝🏽 Credit bars underneath relevant LLM models_

<img width="866" height="267" alt="Screenshot 2025-10-03 at 11 35 19"
src="https://github.com/user-attachments/assets/e7b4c0e7-c93d-4b0f-923d-79ac5d53028b"
/>

_☝🏽 Dialog box when trying to use without available credits_
2025-10-14 07:48:20 -07:00
Keegan George 7d4f756a4f FEATURE: Auto enable AI search (full page) when no regular results (#35336)
## 🔍 Overview

In full page search, when there are no regular results, this update
ensures that AI search gets automatically toggled on with its results.
This update also fixes a minor issue with the checkmark icon in the AI
search toggle being incorrectly overridden by a CSS selector.

No system tests as there is a separate todo pending adding all semantic
search related specs.

## 📹 Screen Recording


https://github.com/user-attachments/assets/86ceee81-6c70-40ac-a0c8-ce67d32373d8


## 📸 Screenshots

Before
<img width="1479" height="152" alt="Screenshot 2025-10-10 at 14 36 32"
src="https://github.com/user-attachments/assets/8bacb549-7422-49ae-9cfd-0518aec78c03"
/>

After
<img width="1491" height="170" alt="Screenshot 2025-10-10 at 14 36 26"
src="https://github.com/user-attachments/assets/1d1c72b5-7aac-45e5-b634-033e344cb385"
/>
2025-10-14 07:17:08 -07:00
Arpit Jalan 0a6b3857c5 FEATURE: Update India Diwali 2025 Holiday (#35354)
https://economictimes.indiatimes.com/news/new-updates/when-is-diwali-in-2025-is-deepawali-on-october-20-or-21-kashi-council-has-cleared-confusion-about-the-real-date/articleshow/124518482.cms
2025-10-14 10:34:02 +05:30
Martin Brennan e4b2c51f6a DEV: Add missing in_reply_to_id to sendChatMessage chat plugin API (#35365)
This option is necessary for plugins to be able to reply to a specific
message in a chat channel, when not using threading.
2025-10-14 13:00:56 +10:00
Alan Guo Xiang Tan cf4193e6e1 FIX: Resolve race condition where draft is not loaded for a chat channel (#35351)
1. In `initializers/chat-setup`, we call the async
`this.chatService.loadChannels()` function which we do not call `await`
on.
2. `ChatChannelRoute`'s `model` calls
`this.chatChannelsManager.find(params.channelId)` which will trigger an
API call if the `this.chatService.loadChannels` function has not loaded
the given channel yet.
3. The `ChatChannel` component is then rendered once the route's model
resolves and the `setup` function is called.
Within the `setup` function,
`this.chatChannelsManager.find(params.channelId)` is called to set the
channel's draft.

If the async call in step 1 does not resolve before step 3 happens, the
channel draft will be blank until the component is rerendered. To
resolve this, we can move the responsibility of loading a channel's
draft into `chatDraftsManager` from the `chat` service into the
`chatChannelsManager` service
instead so that a channel's drafts are populated whenever we store a
channel into `chatChannelsManager`.
2025-10-14 10:14:51 +08:00
Sérgio Saquetim 0c4f285618 DEV: Replace deprecated Ember's array uniq and uniqBy (#35227)
This commit replaces several instances of `.uniq`, `.uniqBy`, and related
array deduplication methods with a new utility function
`uniqueItemsFromArray`. This change ensures proper deduplication logic
across the codebase while addressing the deprecation issues.

**Main Changes:**

* Created new utility function `uniqueItemsFromArray`: Located in a new
file, `array-tools.js`, this function provides a reusable and
configurable alternative for deduplication.
* Replaced old methods: Updated multiple files to use the new utility
function instead of deprecated or custom implementations for
deduplication.
* Replaced manual deduplication: Replace uses of `[...new Set(array)]`
to standardize the deduplication logic across the codebase.
* Added unit tests: Introduced thorough test coverage
(`array-tools-test.js`) to validate functionality and edge cases for the
utility function.
* Updated deprecation workflow: Added logging for deprecated uniq and
uniqBy methods to the `deprecation-workflow.js`.

This change is primarily focused on code quality improvements, ensuring
future-proof deduplication, and maintaining alignment with deprecation
guidelines.
2025-10-13 16:47:36 -03:00
Sérgio Saquetim 68b07535fd DEV: Replace deprecated Ember's array compact (#35259)
This commit replaces the use of `.compact()` with `.filter((item) => item !=
null)` across multiple JavaScript files in the codebase. Additionally,
it introduces a new logging handler for a specific deprecation in the
deprecation workflow.

**Main Changes:**

* Replaced `.compact()` with `.filter((item) => item != null)` to
eliminate the Ember Array dependency and align with native JavaScript
practices.
* Deprecation Workflow: Added a log handler for
discourse.native-array-extensions.compact.
2025-10-13 16:10:36 -03:00
Roman Rizzi f26f894bfc DEV: Re-introduce PG Vector 0.8.0 upgrade (#35233) 2025-10-13 10:55:03 -03:00
Gary Pendergast 68ce9699c4 DEV: Allow query parameters to be sent without JSON-encoding them. (#35314)
The Data Explorer plugin has historically only ever accepted query
parameters as a JSON-encoded string. This behaviour has existed since
the plugin was first created 10 years ago (44bbc78160716dba0d3d456364b975156f8dd50d).

This change doesn't alter how the plugin UI behaves, it simply allows
query parameters to be submitted as a JSON object _or_ as a JSON-encoded
string, rather than requiring that it must be JSON encoded. This allows
developers who call this API directly to work in a more familiar
pattern.
2025-10-13 14:12:29 +11:00
Kris 5f3ae97582 A11Y: add href to post voting comment username (#35325)
An `a` without an `href` or `tabindex` is not tabbable using keyboard
navigation — so we should include the href on usernames here!
Functionality remains the same.

<img width="732" height="104" alt="image"
src="https://github.com/user-attachments/assets/22e9251b-de9e-4fdc-bf2a-99686ac93aca"
/>
2025-10-10 13:37:48 -04:00
Natalie Tay 4adc725d9b DEV: Switch AI debug messages to off by default (#35320)
We do have a lot of messages like the following in dev logs turned on by
default.

```
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 22 response_tokens 13
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 51 response_tokens 57
DiscourseAi::Completions::Endpoints::AwsBedrock: request_tokens 22 response_tokens 13
DiscourseAi::Completions::Endpoints::Gemini: request_tokens 42 response_tokens 9
```

So switching it around to off by default. `DISCOURSE_AI_NO_DEBUG` ->
`DISCOURSE_AI_DEBUG`.

t/159704/34
2025-10-10 21:47:36 +08:00
Rafael dos Santos Silva 376ba06bcd FIX: Reduce false positives in AI LLM status problem check (#35304)
- Skip seeded LLMs from health checks
- Detect and ignore rate limit errors (429, 503, quota exceeded)
- Use framework retry mechanism (max_retries, retry_after, max_blips)
- Remove blocking sleep calls that could tie up Sidekiq workers
- Add transient error detection for network timeouts
2025-10-10 09:47:19 -03:00
Régis Hanol 4364d1eaab FIX: offline mode should not send typing indicator (#35279)
There is no need to tie this to the "allow_users_to_hide_profile" site
setting.

Internal ref - t/164502
2025-10-10 07:33:10 +02:00
Alan Guo Xiang Tan 55b05c921b DEV: Add client settled checks for system tests (#35230)
This change seeks to improve the reliability of our system tests by
resolving the lack of consistency in the state of the client side
application between steps in a system test. This is achieved by patching
various action methods in `Capybara::Playwright::Node` and
`Capybara::Playwright::Browser` so that the methods execute an async
JavaScript function on the client side that waits for the client side
application to reach a settled state. A settled state is currently
defined as:

1. No inflight ajax requests. (_messageBus and presence requests are
excluded_)
2. 2 event cycles of the Javascript event loop has happened for for all
"click", "input", "mousedown", "keydown", "focusin", "focusout",
"touchstart", "change", "resize", "scroll" DOM events that fired.

For debugging purposes, a `--debug-client-settled` CLI flag has been
added to `bin/rspec`. When used, detailed debugging information will be
printed to the browser's console as well as to `stdout` of the
`bin/rspec` process.

This change was inspired by
https://evilmartians.com/chronicles/flaky-tests-be-gone-long-lasting-relief-chronic-ci-retry-irritation
and the https://github.com/makandra/capybara-lockstep rubygem.
2025-10-10 11:03:18 +08:00
Kris 7b3ac3453b FIX: allow AI tagging automation to tag posts by bots (#35310)
Minor follow-up to 20552f0 — posts were still being skipped if the user
is a bot, this will process the posts even if they're from a bot as long
as `allow_system_posts` is true
2025-10-09 18:45:43 -04:00
Kris 991f2af69e DEV: remove ai_bot_enable_dedicated_ux setting (#35301)
This removes the option for the AI bot button to trigger a new PM in the
composer and makes the dedicated /discourse-ai/ai-bot/conversations
route the default for everyone.
2025-10-09 16:18:28 -04:00
Penar Musaraj 8cbc3bcdfc UX: Better separate login and authentication settings (#33711)
This splits the Login and Authentication admin page into multiple
sections: Settings, social logins, DiscourseConnect, OAuth2.0, OIDC.
Internal ticket `t/161648`

This PR also adds a new extension point for plugins that want to extend
this area of the app.

```
register_site_setting_area("oauth2")
register_admin_config_login_route("oauth2")
```

Adding this to a plugin allows it to extend both the setting areas
(existing functionality) and add a tab to this admin settings screen via
`register_admin_config_login_route`.
2025-10-09 15:29:21 -04:00
Sérgio Saquetim 079bf690c0 DEV: Replace deprecated Ember's array toArray (#35290)
This commit refactors code that previously relied on Ember's deprecated array `toArray` method.

- Replaces all usages of `toArray` with native JavaScript array conversion
- Ensures compatibility with newer Ember versions
2025-10-09 16:12:07 -03:00
Discourse Translator Bot 71e81ea9a2 Update translations (#35294) 2025-10-09 12:20:41 +02:00
Natalie Tay 38e6420016 FEATURE: Also process manually updated translations (#35276)
This is a follow up to
https://github.com/discourse/discourse/pull/34900.

When a user manually updates translation via the translation composer,
also send the new translated cooked for post processing. I moved the
Processor to core, given PostLocalizations are core feature.

<img width="551" height="385" alt="Screenshot 2025-10-08 at 6 12 26 PM"
src="https://github.com/user-attachments/assets/1cce7ce3-5487-4e75-90fd-440792b9a899"
/>
2025-10-09 00:33:36 +08:00
Roman Rizzi c680eca69d FEATURE: Add the option to flag, delete and silence in LLM Triage (#35285) 2025-10-08 13:32:10 -03:00
Kris 20552f0fa7 DEV: Allow AI tagging automation to tag system-created topics (#35245)
I want to use the AI llm_tagger script on
https://discover.discourse.com, but in order to do this the automation
needs to be allowed to run on posts created by the system user.

To accomplish this, I've added the ability for scripts to add a
`allow_system_posts` setting. Existing scripts will still ignore system
posts, but this allows script authors to add a setting to opt-in to
processing them.
2025-10-08 11:47:16 -04:00
Discourse Translator Bot 065b604655 Update translations (#35270) 2025-10-08 16:01:09 +02:00
Jarek Radosz a377ed3b2c DEV: Update linting packages (#35278) 2025-10-08 14:19:54 +02:00
Jarek Radosz 2914e7712a DEV: Remove unused service injections (#34750) 2025-10-08 13:31:41 +02:00
Ted Johansson 5cf9108b2d DEV: Simplify automation post editors (#35264)
These automation setups use a full-fledged editor where you can toggle between markdown and rich editing, but they don't have the logic that the composer comes with, that decides whether to display the preview or not, so it still (incorrectly) displays the preview when rich editor mode is selected.

This PR restricts the editor to just rich mode, and disables the preview.
2025-10-08 15:47:39 +08:00
Alan Guo Xiang Tan e49870c2f0 DEV: Fix broken pricing table system test in discourse-subscriptions (#35260) 2025-10-08 15:30:30 +08:00
David Taylor b21d317c64 DEV: Load magnific-popup via npm/webpack (#35250)
This removes our final vendored JS dependency 🎉
2025-10-08 08:28:06 +01:00
Rafael dos Santos SilvaandNat d4e939d053 FEATURE: Add oneboxes and lightboxes to localized posts (#34900)
This change ensures that oneboxes, lightboxes are correctly generated
for localized posts.

The `PostLocalizer` was using `PrettyText.cook` directly, which does not
perform all the necessary post-processing steps, such as onebox
generation.

This commit introduces a new `LocalizedCookedPostProcessor` class that
is responsible for post-processing the cooked HTML of translated posts.
This new class reuses the `CookedProcessorMixin` to gain access to the
`post_process_oneboxes` method. The `PostLocalizer` is updated to use
this new processor, ensuring that oneboxes are correctly generated in
the translated content.

---------

Co-authored-by: Nat <natalie.tay@discourse.org>
2025-10-08 15:14:56 +08:00
David Taylor 843f74e427 DEV: Load chartjs via npm/webpack (#35249) 2025-10-07 21:20:10 +01:00
Kris a1fac56e5b UX: make translations easier to set up by showing requisite site setting (#35078)
This updates /admin/plugins/discourse-ai/ai-translations so that: 

1. We don't show the count for locale detected, we had some feedback
that this was just confusing. Too much of "how the sausage is made."
2. Clarifies some text
* instead of showing the number of posts with locale detected, we just
say "There are N posts eligible for translation."
* Clarifying "backfilling is disabled" to "Backfilling is disabled, only
new posts will be translated."
3. Adds a toggle to enable the feature instead of navigating to the
settings page... this is similar to the AI Spam toggle
4. I was confused when initially trying the plugin, because I didn't
have `Content localization supported locales` configured, and we didn't
mention it. I've added the ability to set this setting from the
translation page when it's not configured, which should help people
successfully set it up without having to bounce around different admin
pages. Adding languages here also toggles on `Content localization
enabled`
5. Added relevant specs 


Before:
<img width="1698" height="440" alt="image"
src="https://github.com/user-attachments/assets/2b9d62c3-f400-40b7-903c-712a7dd55031"
/>

<img width="1718" height="596" alt="image"
src="https://github.com/user-attachments/assets/958b044e-6f92-4739-8108-36f195b389a0"
/>


After: 

With no locale configured... the toggle to enable is disabled 
<img width="1698" height="708" alt="image"
src="https://github.com/user-attachments/assets/35c69496-284c-4973-a5b2-42662d11b9b7"
/>

We can then add the locales, and once saved the toggle becomes active...
<img width="1706" height="562" alt="image"
src="https://github.com/user-attachments/assets/d4624f7e-50f2-41d3-95fd-57d836e25429"
/>

And now it's toggled on... 
<img width="1704" height="706" alt="image"
src="https://github.com/user-attachments/assets/b7ca7e1e-798d-447e-98aa-e7e3f25ed1ff"
/>
2025-10-07 11:23:45 -04:00
Joffrey JAFFEUX 44c1d1a3db DEV: remove stacking context fix (#35231)
The scroll momentum bug has apparently been fixed in iOS 26, given it's
not preventing usage prior to this fix we are just fully removing the
hack.

https://bugs.webkit.org/show_bug.cgi?id=262287
2025-10-07 16:39:09 +02:00
David Taylor d086d6202d DEV: Resolve flaky cancel_manager_spec (#35216)
It was using `WebMock.allow_net_connect!`, which doesn't completely
disable WebMock's stubbing. In the logs of our flaky failures,
backtraces point to the webmock internals.

`WebMock.disable!` is more comprehensive, and matches what we do for
other core specs which need to bypass it.
2025-10-07 10:07:47 +01:00
Kelv ac554f1f60 DEV: add ical format response for discourse-post-events index route (#35143)
Reverts the removal of this from
https://github.com/discourse/discourse-calendar/pull/231. This opens up
the relative url `/discourse-post-event/events.ics` for access to an
ical formatted response.

We also make available the `order` argument for this endpoint which
defaults to ascending order if there is no value or invalid value
passed. This maintains existing behaviour while allowing for users to
specify that they want most recent events first.
2025-10-07 10:19:34 +08:00
Roman Rizzi 0e512ec08b DEV: Revert PG Vector 0.8.0 upgrade (#35220) 2025-10-06 17:27:50 -03:00
Roman Rizzi b51b35b5e8 DEV: Update PG Vector to 0.8.0 (#35156) 2025-10-06 16:28:30 -03:00