Commit Graph
4473 Commits
Author SHA1 Message Date
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
Roman Rizzi 908ba6dc95 FIX: Skip triage on edits when unhandled flags exist (#35218)
When a post is edited, avoid re-flagging it if there’s already a flag
pending in the review queue. This prevents duplicate triage runs and
reduces unnecessary processing.
2025-10-06 15:08:12 -03:00
Jarek Radosz c02de976fc DEV: Clean up d-cakeday code after the move (#35213) 2025-10-06 19:42:22 +02:00
Jarek RadoszandLoïc Guitaut 71834c898f DEV: Update rubocop-discourse to 3.13 and autofix issues (#35073)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-06 16:11:01 +02:00
Arpit Jalan 390eaf532e FEATURE: add plugin_modifier to include AI summary in topic view serializer (#35110) 2025-10-06 17:24:01 +05:30
Discourse Translator Bot f5fa4803e4 Update translations (#35208) 2025-10-06 11:26:37 +02:00
small-lovely-cat 43d6193680 FIX: align text display behaviour for user-menu-billing with other buttons (#35200)
This PR is aimed at fixing a visual
mismatch in buttons at user-menu. More context in https://meta.discourse.org/t/minor-ui-mismatches-in-user-menu-billing-button/384751.
2025-10-06 13:32:45 +08:00
Jarek Radosz 3729361c32 DEV: Move discourse-cakeday to core (#35172)
https://meta.discourse.org/t/373574

Internal `/t/-/159301`
2025-10-03 18:38:51 +02:00
Discourse Translator Bot 5d239c5608 Update translations (#35139) 2025-10-03 15:55:36 +02:00
Jarek RadoszandLoïc Guitaut a54e3208cb DEV: Hand-pick Rails/WhereNot autofixes (#35117)
We can't enable `Rails/WhereNot` lint/autofix, because it would break
code that uses mini_sql instead of AR (which rubocop, and tbh also we,
can't easily differentiate)

Those are safe because they either:
* are executed in AR model scope definitions
* are clearly chained starting from a AR model
* are less-clearly chained, but still can be traced to a AR model/scope

---------

Co-authored-by: Loïc Guitaut <loic@discourse.org>
2025-10-03 13:29:22 +02:00
Loïc Guitaut 0c41ff0680 DEV: Move more data into the server session (#35145)
Now that `ServerSession` can store arbitrary data, we can move some more
data into it.

This patch moves some data related to authentication into it, as
sometimes that kind of data can be pretty big.
2025-10-03 10:20:32 +02:00
Joffrey JAFFEUX ba7fbd6d9c FIX: notification reminder is deleted with bookmark (#35141) 2025-10-03 08:34:19 +02:00
chapoiandMartin Brennan 759fc04041 UX: rework button classes (#34882)
Context: The `btn` mixin is used for every functional button, but this
includes button elements that are not, or should not be, styled like our
default or primary buttons.

To change how this works this commit:
* stripped down the mixin to the bare essentials, mainly limiting to the
properties that use variables.
* moved most things into the `btn` class
* moved some things into specific descriptive classes (default, danger,
success) such as border-radius
Example of button that does not need a border-radius and would benefit
from this:
<img width="464" height="184" alt="CleanShot 2025-09-19 at 12 56 04@2x"
src="https://github.com/user-attachments/assets/e908b2cf-971f-4c1f-aade-7492bad2f89c"
/>

* Deprecated…
  * FlatButton component
* btn-active: we should use the proper pseudoclass :active or a –-active
modifier in code if we need it
* btn-text: every button by default is a btn-text. We already have a
class to indicate when it isn’t (no-text)
* fixed btn-link property to make DButton component behave like an
inline link (no padding, link-styling)
* Since I moved styling from .btn, ths means every button now needs a
specific declaration. So I’ve added btn-default where necessary.
* Fixed btn-flat hover effect: The difference between btn-flat and
btn-transparent was getting very ambiguous. I’ve fixed the hover effect
for btn-flat so that the distinction is:
<img width="1094" height="408" alt="image"
src="https://github.com/user-attachments/assets/addf56a9-1f61-463d-abd9-5028a3b88fad"
/>
* Changed the custom icon colour from header icons so it follows the
normal btn-flat styling, the way the sidebar icon already was doing.
(Consistency)


**Other small button-related change along the way**
What | BC | AC |
|----| ----|--------|
Inconsistent save/cancel colours | <img width="1720" height="1084"
alt="CleanShot 2025-09-19 at 15 31 40@2x"
src="https://github.com/user-attachments/assets/227289c3-6ded-4633-868d-6e33c32d83c3"
/> | <img width="1720" height="1084" alt="CleanShot 2025-09-19 at 15 30
56@2x"
src="https://github.com/user-attachments/assets/b23f96c9-04f3-40ea-9fba-2be59eae8e64"
/> |

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2025-10-02 13:32:36 -06:00