Commit Graph

53499 Commits

Author SHA1 Message Date
Alan Guo Xiang Tan
a30d73f255
DEV: Add validation message to integer fields in theme object editora (#26284)
Why this change?

This is a continuation of 8de869630f.

In our schema, we support the `min` and `max` validation
rules like so:

```
some_objects_setting
  type: objects
  schema:
    name: some_object
    properties:
      id:
        type: integer
        validations:
          min: 5
          max: 10
```

While the validations used to validate the objects on the server side,
we should also add client side validation for better UX.
2024-03-21 15:03:07 +08:00
Alan Guo Xiang Tan
8de869630f
DEV: Add validation message to string fields in theme object editor (#26257)
Why this change?

In our schema, we support the `min_length` and `max_length` validation
rules like so:

```
some_objects_setting
  type: objects
  schema:
    name: some_object
    properties:
      title:
        type: string
        validations:
          min_length: 1
          max_length: 10
```

While the validations used to validate the objects on the server side,
we should also add client side validation for better UX.
2024-03-21 12:39:25 +08:00
Martin Brennan
70f7c0ee6f
FEATURE: More flexible admin plugin config nav definition (#26254)
This commit changes the API for registering the plugin config
page nav configuration from a server-side to a JS one;
there is no need for it to be server-side.

It also makes some changes to allow for 2 different ways of displaying
navigation for plugin pages, depending on complexity:

* TOP - This is the best mode for simple plugins without a lot of different
  custom configuration pages, and it reuses the grey horizontal nav bar
  already used for admins.
* SIDEBAR - This is better for more complex plugins; likely this won't
  be used in the near future, but it's readily available if needed

There is a new AdminPluginConfigNavManager service too to manage which
plugin the admin is actively viewing, otherwise we would have trouble
hiding the main plugin nav for admins when viewing a single plugin.
2024-03-21 13:42:06 +10:00
Alan Guo Xiang Tan
e5566b8519
FIX: Error encountered when adding child object in object setting editor (#26259)
Why this change?

If an object doesn't have any child objects for a particular property
and we try to add one through the editor, an error will be raised.

```
Cannot read properties of undefined (reading 'push')
    at SchemaThemeSettingEditor.addItem (editor.js:190:1)
```
2024-03-21 11:35:49 +08:00
Alan Guo Xiang Tan
4c667f16c7
DEV: Fix state leak in test causing flaky tests (#26282)
Why this change?

The test registers a category custom field to preload but doesn't remove
it at the end of the test causing a state leak which can result in other
tests failing.
2024-03-21 10:49:13 +08:00
Ella E
ef2a9da8e7
UX: Add chevron icons for expanding and collapsing all toggles in the admin sidebar (#26246) 2024-03-21 10:25:14 +11:00
dependabot[bot]
058b70c82f
Build(deps-dev): Bump typescript from 5.4.2 to 5.4.3 (#26276)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.4.2 to 5.4.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release.yml)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.4.2...v5.4.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 07:03:40 +08:00
dependabot[bot]
34a8f682dd
Build(deps): Bump the babel group with 2 updates (#26272)
Bumps the babel group with 2 updates: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.24.1 to 7.24.3
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.3/packages/babel-core)

Updates `@babel/standalone` from 7.24.2 to 7.24.3
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.3/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 07:03:29 +08:00
dependabot[bot]
b02167bb7d
Build(deps-dev): Bump webpack from 5.90.3 to 5.91.0 (#26273)
Bumps [webpack](https://github.com/webpack/webpack) from 5.90.3 to 5.91.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.90.3...v5.91.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 07:03:20 +08:00
dependabot[bot]
d769de2b66
Build(deps-dev): Bump express from 4.18.3 to 4.19.0 (#26277)
Bumps [express](https://github.com/expressjs/express) from 4.18.3 to 4.19.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.3...4.19.0)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 07:03:04 +08:00
dependabot[bot]
1cbe0b7107
Build(deps): Bump nio4r from 2.7.0 to 2.7.1 (#26271)
Bumps [nio4r](https://github.com/socketry/nio4r) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/socketry/nio4r/releases)
- [Changelog](https://github.com/socketry/nio4r/blob/main/changes.md)
- [Commits](https://github.com/socketry/nio4r/compare/v2.7.0...v2.7.1)

---
updated-dependencies:
- dependency-name: nio4r
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-21 05:55:22 +08:00
Kris
59217b8a18
UX: adjust objects editor styles for full page layout (#26265) 2024-03-20 15:55:52 -04:00
David Taylor
3417d15730
DEV: Fix toolbar API deprecation message (#26266) 2024-03-20 17:48:29 +00:00
David Taylor
dd1a14ac6c
DEV: Support new header button/icon ordering APIs on widget header (#26264) 2024-03-20 17:00:55 +00:00
David Taylor
d0d4a363d4
UX: Make input sizing consistent across all browsers (#26159)
Previously we had an iOS-specific sizing rule which would increase inputs to `1.07em`, which would bring them over the 16px 'zoom on focus' threshold in some (but technically, not all) situations.

This commit does two things:

1. Updates the sizing rule from `1.07em` to `max(1em, 16px)`. Essentially: use the cascaded font size, unless it is smaller than 16px

2. Applies that sizing rule on all platforms. This will make Discourse design/theming more consistent across different devices

It also removes some associated CSS rules which no longer make sense.
2024-03-20 16:23:44 +00:00
Jarek Radosz
6d137a41c2
DEV: Remove the last transpile_js mentions (#26263) 2024-03-20 15:32:37 +01:00
David Taylor
aba0df7cf7
FEATURE: Increase default DiscourseConnect session length (#26261)
For some identity providers, 10 minutes isn't much time for a user to complete authentication/registration on the identity provider. Increasing the default to 30 minutes should help in those situations. The nonce is still tied to a single browser session, so there is no material impact on security.
2024-03-20 14:02:12 +00:00
Jarek Radosz
16b377bc3f
DEV: Fix dark mode in QUnit (#26262)
Fixes a semi-recent regression and adds dark color scheme css vars so the rendered app content in tests is dark too.
2024-03-20 14:51:29 +01:00
David Taylor
e3cfb1967d
FIX: Simplify sidebar custom link implementation (#26201)
All our link validation, and conversion from url -> route/model/query is expensive and prone to bugs. Instead, if people enter a link, we can just use it as-is.

Originally all this extra logic was added to handle unusual situations like `/safe-mode`, `/my/...`, etc. However, all of these are now handled correctly by our Ember router, so there is no need for it.

Now, we just pass the user-supplied `href` directly to the SectionLink component, and let Ember handle routing to it when clicked.

The only functional change here is that we no longer validate internal links by parsing them with the Ember router. But I'd argue this is fine, because the previous logic would cause both false positives (e.g. `/t/123` would be valid, even if topic 123 doesn't exist), and false negatives (for routes which are server-side only, like the new AI share pages).
2024-03-20 12:55:40 +00:00
Joffrey JAFFEUX
a884842fa5
FIX: do not use return in block (#26260)
We were incorrectly using `return` in a block which was causing exceptions at runtime. These exceptions were not causing much issues as they are in defer block.

While working on writing a test for this specific case, I noticed that our `upsert_custom_fields` function was using rails `update_all` which is not updating the `updated_at` timestamp. This commit also fixes it and adds a test for it.
2024-03-20 10:49:28 +01:00
David Battersby
2a37be701f
FIX: hide chat btn from user card when chat disabled (#26237)
The issue:
When the current user disables chat from within user preferences, the chat button still appears when clicking another user’s profile picture to open the user card. This is also the case when the current user has chat enabled but the target user has disabled chat.

After this change:
- when a user disables chat in preferences, the chat button should not be displayed when opening a user card or visiting profiles of other users.
- when chat is enabled in preferences but another user disables chat, the chat button should not appear on their user card or profile
2024-03-20 16:24:34 +08:00
Osama Sayegh
ec63f3e782
FEATURE: Buttons to add and remove objects for schema theme settings (#26256)
Continue from https://github.com/discourse/discourse/pull/25673.

This feature adds new buttons for schema theme settings that add/remove objects from lists.
2024-03-20 13:41:12 +08:00
Sérgio Saquetim
c51ae33a54
DEV: Include fullscreen arg in the timeline-footer-controls-after outlet (#26167) 2024-03-20 16:33:45 +11:00
Ted Johansson
370c4156fd
FIX: Add missing chat message illegal flag text (#26255)
When adding the new "illegal" flag option, we missed adding the translation to the chat plugin, so when flagging a chat message (rather than a post) you'd see [en.chat.flags.illegal]. This PR fixes that.
2024-03-20 13:03:33 +08:00
Krzysztof Kotlarek
043117ca13
FEATURE: separate admin page for whats new and reports (#26216)
Currently, a new sidebar link for what's new and reports is going to the main dashboard page and activates the proper tab.

It might be problematic, especially, when the instance has a lot of problems. In that case, it would be difficult for admin to find reports or what’s new which is rendered at the bottom of the page.

Therefore separate pages for reports and what's new were created.

Reports were moved to a component that is shared between a separate page and the dashboard.
2024-03-20 14:23:18 +11:00
Sam
34a14112a7
FIX: remove "fake" mentions from extract_mentions (#26253)
```
<a class="mention" href="/u/test1">bsam</a>
```

Is not a mention of the user sam. We expect an @ in front always.
2024-03-20 12:20:15 +11:00
Ted Johansson
4ca41e0af2
DEV: Promote block problem checks to ProblemCheck (#26193)
In #26122 we promoted all problem checks defined as class methods on AdminDashboardData to their own first-class ProblemCheck instances.

This PR continues that by promoting problem checks that are implemented as blocks as well. This includes updating a couple plugins that have problem checks.
2024-03-20 08:52:25 +08:00
Krzysztof Kotlarek
7f3f07dd40
FIX: missing IST KST and JST timezones in cooked posts (#26252)
In this PR we introduced 3 new timezones to UX - IST, KST and JST

cb2569303f

However, the same has to be done in PrettyText so cooked posts respect those timezones.
2024-03-20 11:28:45 +11:00
Martin Brennan
8180770e7b
FIX: Do not lose admin sidebar when opening chat drawer (#26235)
This commit fixes an issue where the following happens:

1. You open /admin as a member of the admin_sidebar_enabled_groups
1. You then click the chat icon in the header when you prefer to have
   drawer open, or if you just minimise chat into drawer after it opens
   fullscreen
1. You lose the admin sidebar panel, and are reset instead to the main
   panel

Also included is a bit of refactoring to make it so the forcing of
admin sidebar state is in one place.
2024-03-20 09:20:06 +10:00
Jarek Radosz
1f17602b86
DEV: Remove href/auto-route attrs from buttons (#26247)
Those apply only to `a` elements
2024-03-20 06:59:37 +08:00
dependabot[bot]
2db3ddb22e
Build(deps): Bump the babel group with 2 updates (#26250)
Bumps the babel group with 2 updates: [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) and [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/core` from 7.24.0 to 7.24.1
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-core)

Updates `@babel/standalone` from 7.24.0 to 7.24.2
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.2/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
- dependency-name: "@babel/standalone"
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: babel
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-19 23:17:37 +01:00
Isaac Janzen
2947a23a27
FIX: "Flash" when loading search results (#26249) 2024-03-19 15:59:05 -06:00
David Taylor
5098338a96
FIX: Ensure custom composer button 'condition' is run correctly (#26245)
Previously we were only running the `condition` function once, and then overwriting it with a static boolean value. Future changes to composer attributes would not affect button visibility.

This commit fixes the issue and adds an acceptance test for the behavior.
2024-03-19 17:32:52 +00:00
Ella E
ce65a88d6a
FEATURE: Redesign keyboard shortcut modal (#26236) 2024-03-19 10:11:20 -06:00
Discourse Translator Bot
29752dda2e
Update translations (#26242) 2024-03-19 16:00:07 +01:00
Bianca Nenciu
42354ca1ad
PERF: Fix N+1 when loading categories with custom fields (#26241)
Follow up to commit a90b88af56.
2024-03-19 14:11:19 +02:00
Joffrey JAFFEUX
98eb014bdb
FIX: wait for the end of search requests (#26240)
Prior to this fix, if you were following this series of events:
- type something in a select-kit filter with async search
- query starts
- type something again
- first query finished with no results
- second query starts
- 💥 we would show a no content found for a split second
- second query finishes
- we display a list of results
2024-03-19 12:25:25 +01:00
Jarek Radosz
83e73722a7
DEV: Fix typos in a chat service tests (#26239)
channnel -> channel

and use `assert.true()/assert.false()`
2024-03-19 12:07:19 +01:00
Jarek Radosz
6da7865a77
FIX: Regressed scroll-lock after mobile menu close (#26232) 2024-03-19 10:56:46 +01:00
Joffrey JAFFEUX
80d2afa316
FIX: refreshes post toolbar on topic scroll (#26228)
This commit now ensures we will properly attempt to refresh the toolbar position after a scroll and consider it as a selection change.

Tangential to this fix we improved the positioning on mobile to better account for the native menu position and avoid a situation where the toolbar is always behind the native menu and can't be used.
2024-03-19 10:53:51 +01:00
Natalie Tay
0bf87c5ed8
FIX: Prevent content layout shift on mobile (#26238) 2024-03-19 16:56:32 +08:00
Alan Guo Xiang Tan
4f24e3b3b2
DEV: Support running system tests using chromium and custom chromedriver (#26234)
Why this change?

Google does not yet publish binaries for chrome and chromedriver for
`linux/arm64`. In 484954ec4c, we attempted
to add support for running system tests on `linux/arm64` by switching to
Firefox but our system tests seem to make lots of assumptions about
running on chromium based browsers so there are some tests that don't work in Firefox.

This commit works around the lack of chrome and chromedriver binaries by
doing the following:

1. Adds a `DISCOURSE_SYSTEM_TEST_CHROMIUM` ENV variable which when set to
  `1` will allow us to run system tests using a chromium binary. Chromium
  binaries for `linux/arm64` are available and since Chrome is Chromium based, all of our 
  system tests "should pass" even when running against a Chromium binary. I don't expect 
  this to be perfect but I expect it to be better than running against Firefox. This change buys us time
  until Chrome finally ships binaries for `linux/arm64`.

2. Adds a `DISCOURSE_SYSTEM_TEST_CHROMEDRIVER_PATH` ENV variable to
   allow the chromedriver path to be configured. We need this because
   the [electron project](https://github.com/electron/electron/releases) actually
   releases chromewebdriver for `linux/arm64` so someone running
   `linux/arm64` can download the necessary chromedriver from the
   project instead of relying on selenium-manager.

This change is also important for us to support [discourse_test](https://github.com/discourse/discourse_docker/blob/main/image/discourse_test/Dockerfile) and [discourse_dev](https://github.com/discourse/discourse_docker/blob/main/image/discourse_dev/Dockerfile) images targeted at `linux/arm64`.
2024-03-19 14:47:14 +08:00
Natalie Tay
f30cc5ebed
FIX: Show max tag error and prevent search (#26233)
Show the tag limit and prevent searches when max is 0
2024-03-19 12:47:18 +08:00
Jarek Radosz
11099434b5
DEV: Clean up mobileView/desktopView uses (#26229)
Inspired by a piece of "do not do x if it's not a mobile view" code 🙃
2024-03-18 23:29:42 +01:00
dependabot[bot]
9c3ddd46f0
Build(deps-dev): Bump rouge from 4.2.0 to 4.2.1 (#26231)
Bumps [rouge](https://github.com/rouge-ruby/rouge) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.2.0...v4.2.1)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-18 23:18:54 +01:00
dependabot[bot]
c0be49d4e7
Build(deps-dev): Bump rspec-rails from 6.1.1 to 6.1.2 (#26230)
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 6.1.1 to 6.1.2.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v6.1.1...v6.1.2)

---
updated-dependencies:
- dependency-name: rspec-rails
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-18 23:18:20 +01:00
Alan Guo Xiang Tan
239b70342f
PERF: Remove unnecessary <link rel="preload"> for theme javascript (#26220)
This is a follow up to e2da72b76c.

Why this change?

According to https://web.dev/articles/preload-critical-assets,

> By preloading a certain resource, you are telling the browser that you would like to fetch it sooner than the browser would otherwise discover it because you are certain that it is important for the current page.

The preload resource hint is meant to tell the browser to fetch
resources that it would not discover upfront or early. However, we are
not using it the right way because we are literally adding the resource
hint right before a `<script>` tag which means the browser would have
discovered the resource even without the resource hint.

What does this change do?

This commit removes the preload resource hint which are added right
before script tags since the optimization here is highly questionable at the expense of making
our initial DOM larger.
2024-03-19 07:03:49 +11:00
chapoi
fe02868a79
UX: chat > fix lock icon in original message link (#26227) 2024-03-18 19:30:36 +01:00
Bianca Nenciu
d78657bf9b
DEV: Fix spec (#26226)
Follow up to commit a90b88af56.
2024-03-18 20:05:56 +02:00
Régis Hanol
4e02bb5dd9
PERF: avoid publishing user actions to the user who did the action (#26225)
We never use that information and this also fixes an issue with the BCC plugin which ends up triggering a rate-limit because we were publishing a "NEW_PRIVATE_MESSAGE" to the user sending the BCC for every recipients 💥

Internal - t/118283
2024-03-18 18:05:46 +01:00