34379 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Penar Musaraj
b89cf9b443
SECURITY: Disable access to "activate-account" route for existing users 2025-02-04 13:32:38 -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
Blake Erickson
14d1d11536
SECURITY: Sanitize video placeholder urls
Make sure video placeholder urls are valid. An error message is
displayed instead of an infinite loading spinner after clicking play.
2025-02-04 13:32:20 -03:00
Joffrey JAFFEUX
8ad34862e4
DEV: adds includeNone param to form-kit select (#31162)
This option allows to force the presence of none when a value is
selected.
2025-02-04 11:46:24 +01:00
David Battersby
294ed87a6f
UX: restore shared sidebar link for posts and drafts (#31159)
While introducing the new drafts dropdown menu component, we also made
some changes to how the sidebar link works for Drafts. However, after
following user feedback and internal discussions we decided to revert
back to the shared link approach that combines My Posts and My Drafts.
2025-02-04 14:40:18 +04:00
David Taylor
acad83199e
DEV: Make api version optional (#31160)
We'll be making this change more deeply soon. For now, this is the
minimum change required to a this version-free syntax work under
Discourse 3.4.0.
2025-02-04 10:19:04 +00:00
David Taylor
50337a7595
DEV: Pin pnpm to v9 (#31158)
pnpm 10 changed the lockfile syntax slightly, so we need to keep
everyone using v9 until we handle the upgrade.
2025-02-04 09:18:15 +00:00
Joffrey JAFFEUX
1a8b5b9d42
FIX: better standalone checkbox support (#31130)
Before this commit it was complicated to render a `Checkbox` outside of
a `CheckboxGroup` as you would get no title, no description, no optional
hint and not tooltip.

This commits makes all of this possible by adding a special case for
checkboxes, and sharing code for tooltips and optional hint.

This commit also uses this opportunity to refactor part of the code to
use curryComponent and reduce code duplication.
2025-02-04 09:58:00 +01:00
David Battersby
41ce3d868e
UX: improve drafts list (#31122)
Improves the layout for the drafts list page, including the addition of
icons to represent the content type.

Internal ref: /t/129117
2025-02-04 11:42:17 +04:00
Ted Johansson
503f9b6f02
DEV: Use default admin routes for plugins with settings (#30941)
This change adds a sidebar link for each plugin that fulfils the following criteria:

- Does not have an explicit admin route defined in the plugin.
- Has at least one site setting (not including enabled/disabled.)

That sidebar link leads to the automatically generated plugin show settings page.
2025-02-04 14:57:28 +08:00
Jordan Vidrine
9991eacef4
UX: More selectors for transparent buttons (#31155) 2025-02-04 03:04:16 +01:00
Martin Brennan
91e9c1c813
UX: Hide inner site settings sidebar if admin sidebar enabled (#31047)
This experiment hides the list of categories in the inner
sidebar for the main site settings page if the admin sidebar
is enabled. It also defaults the list of settings to "All"
instead of a specific category.

Our theory here is that people who use this page are using
it to find an exact setting, not to go through the categories
one by one. Our admin sidebar also has several groups of important
settings already too, so that can be used for browsing.

Finally, the input on the page focuses when you load it, so
filtering is faster.
2025-02-04 09:24:03 +10:00
Jordan Vidrine
a961f92cc7
DEV: Add removed & back to transparent styling (#31149) 2025-02-03 17:03:45 -06:00