57924 Commits

Author SHA1 Message Date
David Taylor
beb8dc75e9
DEV: Update to OmniAuth 2.0 (#25707) 2025-02-11 11:18:07 +00:00
Loïc Guitaut
a4d34d60e3 DEV: Make Ruby services thread-safe
A previous refactor of the `Service::Base::Step` class introduced a
non thread-safe behavior. `#call` mutates instance variables at runtime,
and since a step instance is the same for any given service class, this
can sometimes lead to `context` being the wrong one for the running
service.

This patch makes use of `Concurrent::ThreadLocalVar` to fix the issue.
2025-02-11 11:18:42 +01:00
Bianca Nenciu
87f8845940
DEV: Split weekly job into multiple smaller jobs (#31260)
The weekly job can take more than 2 hours to run on larger sites. It is
ideal for the jobs to be as small as possible and this is what this
commit attempts.
2025-02-11 10:26:45 +02:00
Martin Brennan
43e8172ebc
UX: Add confirmation to crawler settings (#31269)
Adds a site setting confirmation to the following
settings, since they can be dangerous if changed
incorrectly:

* allowed_crawler_user_agents
* blocked_crawler_user_agents
* slow_down_crawler_user_agents
2025-02-11 13:02:26 +10:00
Ella E.
32704c42d0
UX: Update banner image field to use help text (#30666)
### What's changed?
- Add support for`@helpText` in the FormKit component.
- Updated the about config page to replace `@description` with
`@helpText` for the banner image field

### Before
<img width="525" alt="image"
src="https://github.com/user-attachments/assets/e8cdcca7-1b46-406f-8b6b-815e65dd5d9c"
/>

### After
<img width="256" alt="image"
src="https://github.com/user-attachments/assets/8656b866-5654-4f67-8515-f58a7b2b14c0"
/>


Internal: /t/138358/2
2025-02-10 19:48:31 -07:00
Martin Brennan
f95464ba81
Revert "UX: Hide inner site settings sidebar if admin sidebar enabled (#31047)" (#31267)
This reverts commit 91e9c1c81343990d5ebbb3a3bb7c68ec4445d610.

After feedback, for now we are reverting this change. This is not
permanent, the settings sidebar will be removed again, after we:

* Visually group the settings the same way as the sidebar does
  on All Settings
* Add more settings pages to the main admin sidebar to cover the ~250
  settings not yet represented there
2025-02-11 12:47:40 +10:00
Kris
08b8439e21
DEV: add transformer for default category view setting (#31264)
This allows us to set custom values here, like "Voting" from the topic
voting plugin:
https://github.com/discourse/discourse-topic-voting/pull/232
2025-02-10 16:48:11 -05:00
Angus McLeod
088ac0331e
DEV: Add topic_published event (#31239)
While it is possible derive a topic published event from category id
changes in a `post_edited` or `before_post_publish_changes` event, there
are use cases when a dedicated event is more apposite.
2025-02-10 14:58:58 -05:00
Kris
1d8cdfd5e0
UX: fix horizontal group nav on mobile (#31259)
This fixes the "all groups" link on mobile, follow-up to 50136ee

Before 


![image](https://github.com/user-attachments/assets/c6044ee6-3740-47a7-a006-239980bd7605)


After


![image](https://github.com/user-attachments/assets/9d090046-3131-4a9b-a21c-06c6a47c322b)
2025-02-10 11:43:00 -05:00
Amanda Alves Branquinho
e433be9f61
DEV: Add optional callback in notification dropdown action (#31257)
Modify the component UserNotificationDropdown to receive a function that
will be called after an user is ignored.
2025-02-10 13:26:19 -03:00
Arpit Jalan
85a95e9aa1
FEATURE: add first_post_id to TopicListItemSerializer (#31254)
Will be used in this feature:
https://github.com/discourse/discourse-topic-cards/pull/36
2025-02-10 21:53:05 +05:30
Kris
50136ee4e6
UX: switch group pages to horizontal nav (#31243)
This gets group pages on the same horizontal nav patterns as the user
profile pages. These pages need some more adjustments in general, but
this is a good start!

Before: 

![image](https://github.com/user-attachments/assets/2eaf5504-030f-4c91-a794-f66808fe0576)

![image](https://github.com/user-attachments/assets/5a726208-56ec-437c-8e53-c6edcd2ce772)


After:

![image](https://github.com/user-attachments/assets/f621c371-ac2c-4ab7-af18-d836bcec4c74)

![image](https://github.com/user-attachments/assets/c9eee57e-3e30-4ccb-82a2-29327dae5404)


Before: 

<img
src="https://github.com/user-attachments/assets/b58f1994-8ef8-4a67-9b37-bfee428c343b"
width="350" />

After:

<img
src="https://github.com/user-attachments/assets/013b1af6-ddb9-4a93-bcfe-37b2a9760d8b"
width="350" />
2025-02-10 10:38:31 -05:00
David Taylor
db139534d2
DEV: Drop d-crowd plugin from official list (#31258)
This repo was archived in March 2024 and is no longer supported.

Commit also fixes up the plugin-gem-symlinking logic to support removing
plugins from the list
2025-02-10 15:08:31 +00:00
Jarek Radosz
09bc785fbf
DEV: Fix pnpm dedupe workflow and lock pnpm version (#31244)
Co-authored-by: Discourse CI <ci@ci.invalid>
2025-02-10 14:18:52 +01:00
Kelv
b751742573
FIX: invalid CSP directive sources should allow site to boot with valid CSP directives (#31256)
[Security
patch](5558e72f22)
(for this [CVE](https://nvd.nist.gov/vuln/detail/CVE-2024-54133)) from
rails actionpack was backported from [Rails
8.0.0.1](https://github.com/rails/rails/blob/v8.0.1/actionpack/CHANGELOG.md#rails-8001-december-10-2024)
to previous stable versions including `7-1-stable` / `7-2-stable`.

Any previous version of Discourse upgrading to v3.4.0.beta3 and above
would have observed their sites crashing if they had invalid sources in
their CSP directive extensions.

This fix removes such invalid sources during our build of the CSP, and
logs these at a warning level so devs are able to find out why their CSP
sources were filtered out of the extendable directives.
2025-02-10 20:38:36 +08:00
Ted Johansson
3d11e3ca10
DEV: Require at least one scope for API key granular mode (#31253)
Currently, if creating an API key in "granular" mode, and not selecting any scopes, a globally scoped API key is created. This can be surprising and is not ideal. Having a key with no scopes isn't useful in the first place, so this PR adds client- and server side validations to check that at least one scope is selected if using "granular" mode.
2025-02-10 13:22:08 +08:00
Martin Brennan
7be88bbe8a
FIX: Improvements for uploads:disable_secure_uploads task (#31231)
This commit contains a couple of improvements for this
rake task.

* We no longer limit the uploads to only ones with Post
  upload references, it doesn't matter what the secure uploads
  are linked to, they should all be un-secured
* We now only get distinct uploads from the initial query,
  multiple upload references on the same upload caused
  double ups and confusing counts for the task
* We now also disable the secure_uploads_pm_only site
  setting at the same time
2025-02-10 14:37:42 +10:00
Martin Brennan
ec7c6b1f96
FIX: Incorrect topic per-minute invitation rate limit (#31252)
This fixes an issue where the topic invitation rate limiter
for invites for the 1 minute period was incorrectly using
1 day as the length of time the limit should be applied over.
The default for `max_topic_invitations_per_minute` is 5,
so this would be very easy to exceed, then the user gets
a very confusing warning message saying they have to wait
23 hours to send more invites.

This commit also makes other `RateLimiter` period parameters
more consistent by always using the form `N.PERIOD` instead
of things like `86_400` hardcoded seconds per day.
2025-02-10 13:12:16 +10:00
Sam
8d3a35e25b
DEV: update mini_racer to node 23.6.1 (#31251)
This brings us extremely close to latest
2025-02-10 12:58:34 +11:00
Régis Hanol
541f4ec103
DEV: remove a deprecation notice regarding hard-to-serialize (#31238)
arguments being passed to background jobs.
2025-02-09 15:10:52 +01:00
Régis Hanol
85e82e7be3
DEV: remove another deprecation notice when serializing args (#31240)
to background jobs
2025-02-09 15:10:41 +01:00
Penar Musaraj
54a52e5691
DEV: Improve checking for selected text (#30967)
After you've selected and deselected text, `selection.rangeCount` will
return `true` on future events. Checking for `selection.toString` is
more robust.

Followup to f1bdd86a8c9bec03b962167c37963b1d11d0e5ea
2025-02-07 12:13:39 -05:00
Isaac Janzen
6595b11e25
DEV: Add composer-service-cannot-submit-post transformer (#30903)
- Add `composer-service-cannot-submit-post` transformer to allow for disabling submit based on custom conditions
- Add tests for transformer
- Add a couple helpful appEvents, that plugins can use add custom error popups to plugin-defined fields.
2025-02-07 10:27:26 -06:00
Jan Cernik
42447770bf
FIX: Automatic auth flow with full page login/signup V3 (#31072)
This adds back the fixes from
https://github.com/discourse/discourse/pull/30928 that were reverted by
https://github.com/discourse/discourse/pull/30960.
2025-02-07 10:40:45 -05:00
David Battersby
891d8fe574
UX: use icon for create topic btn on mobile (#31237)
Updates the create topic button to be icon only (mobile) due to screen
space restrictions. The icon is also updated to make it easier to
understand what the button does, even when there is no text.
2025-02-07 18:20:19 +04:00
David Battersby
dc86ebe97a
UX: omit date in user stream for small action posts (#31236)
This change makes it possible to render the action code from small
action posts (ie. close topic etc) without the relative date. This is
applied in the user stream items to prevent duplication of dates.
2025-02-07 17:31:07 +04:00
David Battersby
79041cc1a6
UX: user stream alignment fix for likes (#31234)
Small alignment fix for user stream items on desktop, following changes
made in #31122

We currently have a combination of `post-list-item` and
`user-stream-item` classes within these pages, so I've also applied some
shared styles to these elements to provide a more consistent layout.
2025-02-07 17:28:31 +04:00
David Taylor
6b6b31a97f
FEATURE: Allow admins to opt-in to seamless redirects on /auth/* (#31235)
By default, when multiple login providers are enabled, Discourse
requires user interaction before triggering an external auth flow. This
is defense-in-depth against "Login CSRF" attacks.

This commit introduces a setting to control this behavior, so that it
can be disabled when admins fully trust the downstream systems, and need
an interaction-free login flow on a site with multiple login providers.

Default behavior remains unchanged.
2025-02-07 11:43:39 +00:00
David Taylor
117027a40a
UX: Do not use generic username suggestions for invites (#31175)
6fd577d97d3923cec3d2458f45ebd2704703fd22 widened the scope of
`use_email_for_username_and_name_suggestions` (default false) to include
invites, which means that it fell back to a generic username like
`user1`.

This commit makes it bail out earlier in this situation, so that no
suggestion is attempted.
2025-02-07 10:52:41 +00:00
dependabot[bot]
e55c7700ff Build(deps): Bump logster from 2.20.0 to 2.20.1
Bumps [logster](https://github.com/discourse/logster) from 2.20.0 to 2.20.1.
- [Changelog](https://github.com/discourse/logster/blob/main/CHANGELOG.md)
- [Commits](https://github.com/discourse/logster/compare/v2.20.0...v2.20.1)

---
updated-dependencies:
- dependency-name: logster
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-07 09:34:20 +01:00
Ted Johansson
70eaa976a5
DEV: Refresh translation override status when updating (#31233)
Translation overrides can be marked as "invalid interpolation keys" or "outdated" if the original translation is changed. We run a job every hour to check for this. We also have an admin problem check for it.

The problem is we don't refresh this status when an admin updates the override. So even if the invalid keys are removed, the override will still show up under the "invalid" filter.

There's a similar situation with the "outdated" status. The admin is shown a prompt which they can dismiss, which in turn updates the status, but updating the translation should also count as "addressing" it.

This PR runs a refresh on the override status when updating.
2025-02-07 14:12:28 +08:00
Krzysztof Kotlarek
cc9301a16d
FIX: do not notify admins about PMs when suppress is on (#31232)
When `suppress_secured_categories_from_admin` SiteSetting is enabled, it
is expected that the admin will not be notified about PMs in which they
are not participating - even when they watch the attributed tag.

Before it was only checking if the admin had access to a secured
category assigned to a regular topic. PMs do not have categories so we
need to ensure that admin in participating in that conversation.
2025-02-07 15:04:08 +11:00
Ted Johansson
b46718f628
DEV: Move a plugin related system spec to footnote plugin (#31230)
In a previous PR, I introduced this system spec that checks that a sidebar link is auto-generated for certain plugins.

This causes problems, because the core test suite can be run with plugins either enabled or disabled, causing flaky tests.
2025-02-07 11:58:55 +08:00
Martin Brennan
52a50f1028
PERF: Admin plugin preload settings routes (#31215)
Followup 503f9b6f02ac5c4918d41611848c886b8755e5a0

This previous commit introduced an autogenerated
settings route for every plugin with more than one
setting defined. Plugins with only one setting
only have enabled_site_settings defined, which are
handled using the toggle in the admin plugin list,
so we don't need a dedicated setting page for them.

However in production this introduced a performance
issue, since we were looking through SiteSetting.all_settings
for every plugin, which could be quite slow in some
cases especially on our hosting.

Instead, we already have all the plugin settings cached
inside `SiteSetting.plugins`. We can instead use this to
count how many settings the plugin has, then if there is > 1
for a plugin we use the settings route. This is a much faster lookup
than
searching through SiteSetting.all_settings.
2025-02-07 11:23:43 +10:00
Osama Sayegh
284e708e67
FEATURE: Dark/light mode selector (#31086)
This commit makes the
[color-scheme-toggle](https://github.com/discourse/discourse-color-scheme-toggle)
theme component a core feature with improvements and bug fixes. The
theme component will be updated to become a no-op if the core feature is
enabled.

Noteworthy changes:

* the color mode selector has a new "Auto" option that makes the site
render in the same color mode as the user's system preference
* the splash screen respects the color mode selected by the user
* dark/light variants of category logos and background images are now
picked correctly based on the selected color mode
* a new `interface_color_selector` site setting to disable the selector
or choose its location between the sidebar footer or header

Internal topic: t/139465.

---------

Co-authored-by: Ella <ella.estigoy@gmail.com>
2025-02-07 03:28:34 +03:00
Kris
8c968c588c
FIX: Correct typo in property name for save button component (#31221)
`disabled` -> `disable` to match:
 

0e61565b2b/app/assets/javascripts/discourse/app/components/composer-container.hbs (L238)
2025-02-06 14:24:09 -05:00
Osama Sayegh
c6bbbd0608
FIX: Set the correct state of the dark mode checkbox user preference (#31214)
This commit fixes a bug in the "Dark Mode" checkbox in the interface user
preferences where the checkbox state doesn't appear in the disabled
state if the user disables dark mode.

This happens because when rendering the checkbox, we check the relevant
user options field within the controller's `init` method, but at that
point in the controller's life cycle, the `user_option` object isn't
available. What we should do instead is move this check to the route's
`setupController` method where the `user_option` object is available and
we can set the correct state on the controller.

https://meta.discourse.org/t/-/349976 (private topic)
2025-02-06 20:31:37 +03:00
Kris
3e4929fd7e
DEV: add topic-footer-button class to all topic footer buttons (#31209)
While working with some themes, I noticed that all of these buttons
don't have the `topic-footer-button` class, so it can't really be used
effectively. The admin menu, bookmark button, and reply button were all
missing it. This adds the class.


![image](https://github.com/user-attachments/assets/3d374896-5d45-445a-9970-1d3f3f4f06de)
2025-02-06 12:23:47 -05:00
Kris
a38a1393b5
DEV: Fix syntax for outletArgs in header component (#31220)
The parenthesis were causing minimized to return undefined
2025-02-06 11:32:33 -05:00
Angus McLeod
fe4c33323f
DEV: Add topic-map plugin outlet wrapper (#31168) 2025-02-06 10:59:53 -05:00
Arpit Jalan
aa222ef7b8
FEATURE: add first post likes data serializer (#31216)
This PR adds two attributes (`op_can_like` & `op_liked`) to
`TopicListItemSerializer`.

We've also added `serialize_topic_op_likes_data` theme modifier so that
these two attributes are only added when a theme or component needs this
data.
2025-02-06 20:50:30 +05:30
Blake Erickson
bc29fbeac8
DEV: Have group smtp email job retry (#31202)
Likely we want the group smtp email job to retry. Also added a check to
see if we already have an email log entry for the message to avoid
possible duplicates on retry.

Related previous commit: ed47b550266e1ab669c756b0ecb48d1685b08fee
2025-02-06 04:52:35 -07:00
Ella E.
d4e3595a07
FIX: Adjust badge selector for proper nesting in plugin list (#31218)
This PR fixes an issue where badges weren’t displaying correctly due to
improper CSS targeting.

/t/147165
2025-02-06 04:26:07 -07:00
Loïc Guitaut
f057c71fc8 DEV: Follow-up to the lock step for services
This patch adds two things:

1. An outcome matcher (`on_lock_not_acquired`), allowing to react when
   there was a problem with the lock.
2. Compatibility with the steps inspector, allowing to display properly
   the steps of a service containing locks.
2025-02-06 11:38:15 +01:00
Ted Johansson
997a9e3de9
FEATURE: Allow excluding uploads from min post length requirement (#31194)
Currently, the markdown for uploads is counted towards post minimum length requirements. This change introduces a site setting `prevent_uploads_only_posts` which can be flipped to exclude upload segments from the calculation.
2025-02-06 10:26:23 +08:00
Saif Murtaza
ae2eadcced
Revert "Update INSTALL-cloud.md" (#31103)
Reverts discourse/discourse#31089
2025-02-06 11:08:19 +09:00
Ted Johansson
af43f6135e
FIX: Only include custom plugin config routes in tabs for old show page (#31213)
Same as #31192, but for plugins that are not yet converted to the new show page. 🙏
2025-02-06 10:03:01 +08:00
Krzysztof Kotlarek
c5bead4369
FEATURE: show flag description along with additional reason (#31210)
Currently, the description is hidden when an additional reason field
appears on the flag modal. It can contain important guidance and
therefore should never be hidden.

<img width="671" alt="Screenshot 2025-02-06 at 9 59 42 am"
src="https://github.com/user-attachments/assets/97629059-f346-4696-b720-9a9da3faf8f8"
/>
2025-02-06 12:47:31 +11:00
Martin Brennan
f413e1b0de
FIX: Clean up not secure uploads with access_control_post_id (#31189)
Until now, we were excluding uploads with a not null
access_control_post_id from cleanup, because we were still
considering them "secure" even though they might have been
`secure: false`.

It's not necessary to keep these around, these are no more
important than regular uploads if they are not referenced
by anything.
2025-02-06 11:26:34 +10:00
Martin Brennan
8f72a57363
UX: Conditionally refresh page on wizard styling step (#31193)
Previously, were always forcing the page to reload
for the wizard after pressing Next for the styling step,
with the logic that if style changes are being made,
the admin needs to see them straight away.

However this doesn't make sense if nothing changes on
that step. This commit makes the change to only refresh
the page if any of the settings on the step changed,
bringing it in line with other steps.
2025-02-06 10:31:22 +10:00