57893 Commits

Author SHA1 Message Date
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
Martin Brennan
1ab5bc2bad
UX: Remove enable_quote_copy site setting (#31191)
This setting was introduced a year ago for
51016e56dd99a9ad4bd82cdc6c0cf968754c70ed, which was
formerly a design experiment.

In practice on our hosting, noone has ever disabled this
setting, and it's for a useful feature. There is no
point keeping it.


![image](https://github.com/user-attachments/assets/97418e7e-2311-4ba0-bf18-41f3f55ab001)
2025-02-06 10:31:10 +10:00
Penar Musaraj
b9d4c57f07
UX: Fix HTML showing in delete user button (#31201)
Also rewords it to clarify the action. And ensures both `delete` buttons
get the `btn-danger` class.
2025-02-05 16:28:10 -05:00
Jarek Radosz
7ec9885454
DEV: Enable and fix more stylelint rules (#31200)
* `color-no-invalid-hex`
* `unit-no-unknown`
* `declaration-block-no-duplicate-custom-properties`
* `block-no-empty`
* `selector-type-no-unknown`
* `selector-pseudo-element-no-unknown`
* `scss/double-slash-comment-whitespace-inside`
* `font-family-no-missing-generic-family-keyword`
* `function-linear-gradient-no-nonstandard-direction`
2025-02-05 20:03:56 +01:00
Kris
5b8b534267
UX: fix layout of invite modal errors (#31199)
Flex is causing odd wrapping for errors with multiple elements within.

Before: 

![image](https://github.com/user-attachments/assets/73f30c46-ef44-48ef-b249-e955c2ce71e1)

After:

![image](https://github.com/user-attachments/assets/454f2857-3eb5-4fc6-a7f3-752a0d2a3add)
2025-02-05 13:33:52 -05:00
Kris
553a8851ab
UX: left-align dropdown menu button text (#31198)
When dropdown button text wraps onto multiple lines, it's centered. It
should be left-aligned instead.

Before: 

<img
src="https://github.com/user-attachments/assets/64db1e0c-8dc0-4e26-8b07-fea938498f80"
width="250"/>

After:

<img
src="https://github.com/user-attachments/assets/7f4c1795-291a-4772-bdb0-f848f3904aa4"
width="250"/>
2025-02-05 12:43:13 -05:00
Jarek Radosz
39b1ac91b8
DEV: Merge duplicated css (#31167)
Fixes `no-duplicate-selectors` stylelint rule.
2025-02-05 18:42:55 +01:00
Joffrey JAFFEUX
4a7a9efbb9
FIX: correctly check for hasData in admin-report (#31197)
Using length is not working on javascript objects and this would always
be falsey.

```
const test = { foo: 1 };
test.length // undefined
```
2025-02-05 17:19:33 +01:00
Osama Sayegh
bb91561b9e
FIX: Propagate pointerdown events on DMenu trigger when the menu isn't expanded (#31104)
Stopping propagation when a `DMenu`'s trigger is clicked could prevent
another floating UI element, e.g. the search menu in the header, from
closing when clicking outside of it. We call `stopPropagation` on the
event to allow more clicks within a `DMenu`'s trigger without it getting
closed, so we shouldn't stop the event propagation if the `DMenu` hasn't
been expanded yet.
2025-02-05 18:01:37 +03:00
Kris
0da3349513
UX: fix wrapping of topic map links with counter (#31184)
Due to a change with how the link counter renders (as a pseudo element)
the grid layout in the topic map link modal regressed slightly with long
links


before: 

![image](https://github.com/user-attachments/assets/f7ea022c-62f9-44da-a575-4e7f46d31985)


after:
<img
src="https://github.com/user-attachments/assets/1c955593-beae-4795-9d90-9a50fd7646dd"
width="500">
2025-02-05 08:28:22 -05:00
Jarek Radosz
5b5899b543
UX: Update bot-indicator styling (#31108)
Before/After

<img width="334" alt="Screenshot 2025-02-01 at 12 05 39"
src="https://github.com/user-attachments/assets/6939c586-3166-42e8-aa71-1062b282eeb8"
/> <img width="334" alt="Screenshot 2025-02-01 at 12 06 38"
src="https://github.com/user-attachments/assets/506f460a-7f85-418d-bd5d-b7cecd26abac"
/>
2025-02-05 12:44:50 +01:00
Jarek Radosz
b839d09dfb
DEV: Fix declaration-block-no-shorthand-property-overrides (#31166) 2025-02-05 12:36:21 +01:00
David Battersby
5f0c21d906
UX: multiple drafts menu improvements (#31195)
This change includes the following updates:

- Rename view all to view all drafts
- Remove view all link from drop-down when all drafts are displayed in
the menu
- Different icon for draft topics and PMs (adds envelope for PMs)
- Disable drop-down when New Topic button is disabled (private
categories etc)
- Improve drafts drop-down loading (no longer disables the trigger btn
on click)
2025-02-05 15:19:13 +04:00
Ted Johansson
bb12f8275d
DEV: Only include custom admin UIs in the plugins index tabs (#31192)
In the current admin index page, all plugins show up as tabs. This includes plugins with auto-generated config routes.

This changes the tabs to include only plugins with custom UIs.
2025-02-05 15:02:46 +08:00
Krzysztof Kotlarek
5eb7d6d9c0
FEATURE: Gracefully handle unhandled reviewables (#31118)
Plugins like for example AI or Akismet create reviewable items. When the
plugin is disabled, then we cannot properly handle those items.

In that situation, we should display warnings about unhandled types.
Instruct admin to reenable plugins. In addition, we should allow the
admin to delete all pending reviews from disabled plugins.
2025-02-05 14:38:45 +11:00
Gary Pendergast
f439bf14cc
DEV: Refactor the Automation Plugin UI to match admin UI guidelines (#31060)
This change updates the Automation plugin to make use of the `use_new_show_route` plugin flag, as well as generally updating the UI to match current admin UI guidelines. Notable changes include:

- Moving template/router/controller files to make use of the `admin.adminPlugins.show` route.
- Changing the URIs from `/admin/plugins/discourse-automation` to `/admin/plugins/automation`, to match the `PLUGIN_NAME`.
- Adding UI wrappers around the New/Edit forms, and polishing the list of defined automations.
2025-02-05 14:34:15 +11:00
Martin Brennan
a2dbcedbd9
UX: Show parent category name for category hashtags (#31188)
This commit changes the display of category hashtag
autocomplete to show the parent category name in this
format:

* Parent Name > Child Name

This helps further distinguish categories in the autocomplete
where there may be multiple different parent categories with
the same name child category, e.g. if every category has an
Announcements subcategory.
2025-02-05 12:31:50 +10:00
Ted Johansson
f01c0c9740
DEV: Remove deprecated plugin config nav mode option (#31157)
In #31012 we deprecated this nav mode option when registering a plugin in a backwards compatible way.

We have now removed its use in all relevant plugins and should be ready to completely remove it from core.
2025-02-05 09:41:40 +08:00
Joffrey JAFFEUX
5ccd6391d8
FIX: correct mobile height of badge and ownership modals (#31187) 2025-02-05 00:25:03 +01:00
Kris
0cb27f433a
A11Y: fix post control button contrast issue for WCAG colors (#31177)
We had a little regression here: 

Before:


![image](https://github.com/user-attachments/assets/f486ac9b-3c68-4a89-be3d-38e0144669e8)


After: 


![image](https://github.com/user-attachments/assets/4ecbefab-01ce-44e0-8f16-25a5360da0b7)

Upon closer inspection, a lot of the post control styles here are no
longer necessary, as the contrast is fine without them:


![image](https://github.com/user-attachments/assets/f16193bb-4079-43e8-9924-c2e02016a815)
2025-02-04 15:17:29 -05:00
Kris
8a83f6997b
UX: ensure all children of .with-topic-progress are clickable (#31176)
This is a follow-up to 71eb2f6cda9ad8a69ba1ae7d506440c3ff0bc9cb, we have
outlets in this wrapper too — so best to re-enable pointer events on all
immediate children of the disabled wrapper.
2025-02-04 14:51:54 -05:00
Renato Atilio
0e61565b2b
FEATURE: introduce a ProseMirror editor (#30815)
This is the first in a series of PRs to introduce a
ProseMirror-based
WYSIWYM editor experience
alongside our current textarea Markdown editor.

Behind a hidden site setting, this PR adds a toggle to the composer
toolbar, allowing users to switch between the two options.

Our implementation builds upon the excellent ProseMirror and its
non-core Markdown
module, using the
module's schema, parsing, and serialization definitions as the base for
further Discourse-specific features.

An extension API is included to enable further customizations.

The necessary extensions to support all Discourse's core and core
plugins features **will be implemented in subsequent PRs**.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2025-02-04 14:37:18 -03:00
David Taylor
6d6e9c174d
DEV: Switch to 'unstable' glint dependencies (#31169)
This may help to resolve the "ScriptType" errors we're seeing in the
language server
2025-02-04 17:32:00 +00:00
Roman Rizzi
ee33535013
Bump version to v3.5.0.beta1-dev 2025-02-04 13:49:16 -03:00
Roman Rizzi
76e7f12a6d
Bump version to v3.4.0.beta4 2025-02-04 13:49:16 -03:00
OsamaSayegh
416ec83ae5
SECURITY: Limit /inline-onebox to 10 URLs at a time 2025-02-04 13:32:53 -03:00
David Taylor
6d0173c9bd
SECURITY: Ensure user-stream topic titles are always escaped correctly
In core, `escapeExpression` was being applied during the model loading phase. However, plugin consumers of the UserStreamItem component were not necessarily doing the same.

This commit moves the emoji-replacement logic (which also safely handles escaping) into the component template, so that it is safe-by-default, regardless of how it's used by plugins.
2025-02-04 13:32:49 -03:00
Gary
d2de58e760
Don't allow loading tagged PMs in another user's inbox. 2025-02-04 13:32:46 -03:00
David Battersby
3d47a1268c
SECURITY: Ability to bypass disabling chat of users 2025-02-04 13:32:42 -03:00
Penar Musaraj
b89cf9b443
SECURITY: Disable access to "activate-account" route for existing users 2025-02-04 13:32:38 -03:00
Blake Erickson
17116c440b
SECURITY: Restrict allowed URL patterns
Restrict allowed URL patterns for oneboxes.
2025-02-04 13:32:34 -03:00
Alan Guo Xiang Tan
17e1bfe069
SECURITY: Preload data only when rendering application layout
This commit drops the `before_action :preload_json` callback in `ApplicationController` as it adds unnecessary complexity to `ApplicationController` as well as other controllers which has to skip this callback. The source of the complexity comes mainly from the following two conditionals in the `preload_json` method:

```
    # We don't preload JSON on xhr or JSON request
    return if request.xhr? || request.format.json?

    # if we are posting in makes no sense to preload
    return if request.method != "GET"
```

Basically, the conditionals solely exists for optimization purposes to ensure that we don't run the preloading code when the request is not a GET request and the response is not expected to be HTML. The key problem here is that the conditionals are trying to expect what the content type of the response will be and this has proven to be hard to get right. Instead, we can simplify this problem by running the preloading code in a more deterministic way which is to preload only when the `application` layout is being rendered and this is main change that this commit introduces.
2025-02-04 13:32:30 -03:00