Commit Graph

33242 Commits

Author SHA1 Message Date
David Taylor 80b9c280ba
DEV: Switch to pnpm for JS dependencies (#28671)
This will bring significant improvements to install speed & storage requirements. For information on how it may affect you, see https://meta.discourse.org/t/324521

This commit:
- removes the `yarn.lock` and replaces with `pnpm-lock.yaml`
- updates workspaces to pnpm format
- adjusts package dependencies to work with pnpm's stricter resolution strategy
- updates Rails app to load modules from more specific node_modules directories
- adds a `.pnpmfile` which automatically cleans up old yarn-managed `node_modules` directories
- updates various scripts to call `pnpm` instead of `yarn`
- updates patches to use pnpm's native patch system instead of patch-package
- adds a patch for licensee to support pnpm
2024-09-03 10:51:07 +01:00
Natalie Tay cc873977ec
DEV: Ensure unique notification level per tag user (#28638)
TagUser.rb is used to set user notification levels for a tag, we don't have a unique index on the notification level itself. This means that there might be some weird case where a user may have multiple of the same notification level on a tag.

This PR adds a migration which de-duplicates this based on defaults, where we keep the earliest record in the event there is multiple notification level per-user-per-tag.
2024-09-03 15:43:02 +08:00
Linca 74c9b5c11c
FIX: Keep the original URLParams in navigation item (#28696)
Originally, we assumed that the href passed to the NavigationItem must
not have URLParams, and roughly appended URLParams such as
`?order=created` to the end. This will result in something like
`/latest?state=my_votes?order=created` (note the double question mark
here), for example the discourse-topic-voting plugin

This commit modifies the logic for appending URLParams to the end,
ensuring that the original URL parameters are preserved.
2024-09-03 15:16:52 +08:00
Kelv a455567f9e
DEV: make UserPassword 1:1 to User (#28528)
* add data migration to keep only unexpired or most recently expired user password
* refactor to 1:1 relationship between User and UserPassword
* add migration to remove redundant indexes on user passwords
2024-09-03 11:09:33 +08:00
Osama Sayegh 9780f0fd52
UX: Adjustments for the about page banner image (#28692)
Meta topic: https://meta.discourse.org/t/new-about-banner-cut-off-on-mobile/324354?u=osama
2024-09-03 02:36:28 +03:00
Krzysztof Kotlarek 7577231ba2
DEV: the ability to define setting areas (#28570)
A new setting attribute is used to define the areas (separated by `|`).

In addition, endpoint `/admin/config/site_settings.json` accepts new `filter_area` data.
2024-09-03 09:25:45 +10:00
Guhyoun Nam 050c665160
FEATURE: Added Category Experts approved WebHook Event (#28525)
This PR is adding a Category Experts WebHook event type.
2024-09-03 06:59:15 +09:00
Joffrey JAFFEUX b771d3173f
FIX: ensures default required validator handles 0 (#28686)
Prior to this fix `0` would be erroring as non-existing and would raise the required error.
2024-09-02 20:46:04 +02:00
Joffrey JAFFEUX b4f8ea6ade
FIX: correctly pass updateGroupings to the modal (#28683)
A previous refactor has moved this function in the controller instead of the route making it inaccessible to the modal.

This commit is fixing this and also adding a spec.
2024-09-02 17:32:18 +02:00
David Battersby 997fbc9757
FEATURE: Add ability to watch chat threads (#28639)
This change introduces a new thread notification level allowing users to get notified when someone replies to the thread.

Users who watch a thread will get a green notification on the chat icon and a user notification (blue). User notifications are consolidated based on thread id to prevent cluttering the original users notification area.

---------

Co-authored-by: Régis Hanol <regis@hanol.fr>
2024-09-02 16:45:55 +04:00
David Taylor cef1dcfc7d
DEV: Support passing component class to RenderGlimmer (#28660)
In particular, this allows us to use gjs `<template>` for RenderGlimmer, registerWidgetShim, and decorateCooked's `helper.renderGlimmer`.

```js
// Simple component class:
registerWidgetShim(
  "render-glimmer-test-component-shim",
  "div.initial-wrapper-class",
  SimpleComponent
);
```

```gjs
// Or an inline `<template>`
registerWidgetShim(
  "render-glimmer-test-component-shim",
  "div.initial-wrapper-class",
  <template>Hello world</template>
);
```
2024-09-02 11:21:46 +01:00
David Taylor 583c932173
DEV: Refactor complex initializers into classes (#28661)
We're working to remove all decorators from object-literal-properties. This commit refactors all initializers which were using these decorators into classes, where decorators are allowed. Also adds cleanup logic to the local-dates initializer, which was previously missing.
2024-09-02 10:08:07 +01:00
David Taylor 8b2009cd44
DEV: Skip babel for ace-builds and json-editor (#28659)
This will avoid warnings: "The code generator has deoptimised the styling of {path} as it exceeds the max of 500KB."

Should also provide a tiny improvement in build times
2024-09-02 10:07:43 +01:00
dependabot[bot] a88b0d3f10
Build(deps-dev): Bump @swc/core from 1.7.21 to 1.7.22 (#28678)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.21 to 1.7.22.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.21...v1.7.22)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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-09-02 10:06:59 +02:00
dependabot[bot] 72896d44b8
Build(deps-dev): Bump the embroider group with 4 updates (#28677)
Bumps the embroider group with 4 updates: [@embroider/compat](https://github.com/embroider-build/embroider/tree/HEAD/packages/compat), [@embroider/core](https://github.com/embroider-build/embroider/tree/HEAD/packages/core), [@embroider/macros](https://github.com/embroider-build/embroider/tree/HEAD/packages/macros) and [@embroider/webpack](https://github.com/embroider-build/embroider/tree/HEAD/packages/webpack).


Updates `@embroider/compat` from 3.6.0 to 3.6.1
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/compat)

Updates `@embroider/core` from 3.4.14 to 3.4.15
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/core)

Updates `@embroider/macros` from 1.16.5 to 1.16.6
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/macros)

Updates `@embroider/webpack` from 4.0.4 to 4.0.5
- [Release notes](https://github.com/embroider-build/embroider/releases)
- [Changelog](https://github.com/embroider-build/embroider/blob/main/CHANGELOG.md)
- [Commits](https://github.com/embroider-build/embroider/commits/HEAD/packages/webpack)

---
updated-dependencies:
- dependency-name: "@embroider/compat"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: embroider
- dependency-name: "@embroider/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: embroider
- dependency-name: "@embroider/macros"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: embroider
- dependency-name: "@embroider/webpack"
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: embroider
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-02 10:06:40 +02:00
dependabot[bot] 5f7267a57f
Build(deps): Bump ace-builds from 1.36.0 to 1.36.2 (#28679)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.36.0 to 1.36.2.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.36.0...v1.36.2)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  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-09-02 10:00:46 +02:00
Mark VanLandingham 3e320ce225
DEV: Add 'multiple' class to login-buttons when there are multiple btns (#28649) 2024-08-30 08:36:08 -05:00
dependabot[bot] 06fdd9af1f
Build(deps): Bump @babel/standalone in the babel group (#28650)
Bumps the babel group with 1 update: [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/standalone` from 7.25.5 to 7.25.6
- [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.25.6/packages/babel-standalone)

---
updated-dependencies:
- 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-08-30 10:55:53 +01:00
Martin Brennan 361e954c55
UX: Change admin plugins list to follow UI guidelines (#28478)
This commit introduces a little bit of duplication
since the old plugin UIs not using the new plugin show
page look different from ones like AI and Gamification
which have been converted. We can use the new admin
header component on the plugins list, but for the other
pages we are manually rendering a breadcrumb trail and
the list of plugin tabs.

Over time as we convert more plugins to use the new UI
guidelines and show page we can get rid of this duplication.
2024-08-30 14:53:36 +10:00
Martin Brennan ca26099a8d
UX: Add descriptions to auto groups and auto group indicator (#28630)
This commit adds a description for all the auto groups
which will be shown in the group list and show group
pages, which will help admins understand their purpose
better.

Also adds an indicator with a tooltip to explain what
the auto groups are on the group show page.
2024-08-30 10:52:34 +10:00
Martin Brennan daa06a1c00
DEV: Improve external upload debugging (#28627)
* Do not delete created external upload stubs for 2 days
  instead of 1 hour if enable_upload_debug_mode is true,
  this aids with server-side debugging.
* If using an API call, return the detailed error message
  if enable_upload_debug_mode is true. In this case the user
  is not using the UI, so a more detailed message is appropriate.
* Add a prefix to log messages in ExternalUploadHelpers, to
  make it easier to find these in logster.
2024-08-30 10:25:04 +10:00
Jean 22c7fde850
DEV: Add plugin outlet to the group info template (#28624)
* DEV: Add plugin outlet to the group info template
2024-08-29 14:02:33 -04:00
Amanda Alves Branquinho bdd00a84b0
DEV: Introduce topic category wrapper outlet (#28585)
* dev: Introduce topic category wrapper outlet

* fix lint issue

* rename the outlet so it is unique
2024-08-29 14:01:36 -03:00
Mark VanLandingham ae111904ef
DEV: Add container with classname to invited-by invite section (#28644) 2024-08-29 11:31:13 -05:00
chapoi 5aab69676b
UX: change usercard selector to new identifier (#28641) 2024-08-29 18:11:27 +02:00
Renato Atilio 54d6e52607
FIX: chat mailer log noise (#28616)
Fixes the log noise caused by a deprecation notice
2024-08-29 11:39:08 -03:00
Joffrey JAFFEUX 4f705b3146
FIX: ensure About#stats uses the cache (#28634)
Prior to this fix we were calling `fetch_stats` which is never checking if we have a cache entry. This call is making a lot of SQL calls, so it's better to use the cache.
2024-08-29 12:16:57 +02:00
David Taylor 8b6c5da755
DEV: Stop using sprockets for 'use ember cli' stylesheet (#28633)
This was throwing the "Discourse does not support compiling scss/sass files via Sprockets" error if the file was not cached
2024-08-29 10:38:27 +01:00
Bianca Nenciu 95b09dd777
DEV: Log live slots of Sidekiq jobs (#28600)
Introduce a new log line for Sidekiq jobs that consume more than
`DISCOURSE_LIVE_SLOTS_SIDEKIQ_LIMIT` live slots. This is useful to
track down jobs that may leak memory.

This is enabled only when Sidekiq's job instrumenter is enabled (set
`DISCOURSE_LOG_SIDEKIQ` to `1`).
2024-08-29 12:23:27 +03:00
Ted Johansson bfad9a7170
DEV: Gracefully handle an array of IDs passed to Topics#show (#28631)
We're seeing a lot of log noise coming from unhandled exceptions stemming from requests to TopicsController#show where id is passed in as an array.

In the implementation of the method, we assume that if id is present it will be a string. This is because one of the routes to this action uses :id as a URL fragment, and so must be a string. However, there are other routes that go to this endpoint as well. Some of them don't have this URL fragment, so you can pass an arbitrary id query parameter.

Instead of a downstream unhandled exception, we raise a Discourse::InvalidParameters upfront.
2024-08-29 14:22:42 +08:00
Jan Cernik 0ee68b3583
FIX: Use `.login-right-side` instead of `.has-alt-auth` (#28628) 2024-08-29 16:09:02 +10:00
dependabot[bot] d45d315a26
Build(deps-dev): Bump @swc/core from 1.7.18 to 1.7.21 (#28618)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.18 to 1.7.21.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.18...v1.7.21)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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-08-29 09:29:15 +08:00
Krzysztof Kotlarek b90b56f953
FIX: do not enforce 2fa when an account is created with OAuth (#28625)
In this PR we introduced a new setting `enforce_second_factor_on_external_auth` which disables enforce 2FA when the user is authenticated with an external provider.

https://github.com/discourse/discourse/pull/27506

However, with the first registration with an external provider, we authenticate the user right after activation. In that case, we need to also keep information that the user was authenticated with an external OAuth provider.
2024-08-29 11:19:04 +10:00
Joffrey JAFFEUX 6f91014d64
FIX: correctly filter user bookmarks (#28612)
We were not updating `searchTerm` when changing the input which was making us always send an empty q parameter.

This commit is also adding tests for:
- initial url with q param
- filtering the bookmarks through the input
2024-08-28 15:39:07 -04:00
David Taylor 5df3aa66c8
DEV: Update `registerUnbound()` to native class syntax (#28613) 2024-08-28 19:06:14 +01:00
David Taylor efa08658be
DEV: Convert badge & preferences controllers to native class syntax (#28608)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 17:18:22 +01:00
David Taylor 7210f36801
DEV: Convert eyeline & posts-with-placeholders to native class syntax (#28609) 2024-08-28 17:06:34 +01:00
David Taylor a0d2cb052e
DEV: Convert raw-views to native class syntax (#28607)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 17:05:24 +01:00
David Taylor cb883ceb74
DEV: Convert wizard components to native class syntax (#28606)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 16:48:21 +01:00
David Taylor 8cc6b214dd
DEV: Convert core components to native class syntax (batch 9) (#28604)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 16:25:29 +01:00
David Taylor 2e5502c417
FIX: Restore `propertyEqual` following native-class conversions (#28605)
I mistakenly replaced these with `@equal`, thinking the behavior was the same. It's not. `@propertyEqual` compares two properties, while `@equal` compares a single property with a constant.
2024-08-28 16:20:16 +01:00
David Taylor 54b281c4a2
DEV: Convert core components to native class syntax (batch 8) (#28602)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 16:20:04 +01:00
David Taylor 4150ec960e
DEV: Convert core components to native class syntax (batch 7) (#28603)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 16:15:13 +01:00
Loïc Guitaut d26d45540e DEV: Use `run_successfully` matcher in service specs 2024-08-28 16:30:09 +02:00
Joffrey JAFFEUX 0977f9fb47
FIX: correctly render ace editor in FormKit (#28601)
Im not sure when, but hierarchy changed and style were not correctly applied.
2024-08-28 16:24:44 +02:00
David Taylor c4428715b5
DEV: Convert core components to native class syntax (batch 6) (#28598)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 14:34:02 +01:00
David Taylor 77d4b3304e
DEV: Convert core components to native class syntax (batch 5) (#28597)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 14:32:56 +01:00
David Taylor 935cbbb6a9
DEV: Convert core components to native class syntax (batch 4) (#28595)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-28 14:32:41 +01:00
David Taylor 2bc30bd7b8
DEV: Update DiscourseRoute and ApplicationRoute to native class syntax (#28594)
Changes made using the ember-native-class-codemod, plus some manual tweaks

Also ensures our implicit injections applied to the prototype immediately. Without this, they will only be applied on the next `.extend()` call, which is now later than the first native-class extension.
2024-08-28 13:05:06 +01:00
Jan Cernik b092ccbdc5
UX: Add progress bar to the registration flow (#27694) 2024-08-28 08:43:39 -03:00
Natalie Tay 3a04443632
FIX: Sum pageviews with number instead of string (#28596)
When the tooltip items are tooltipItem = [{parsed: {y:12} }, {parsed: {y:10} } ], reducing without a initial value as a number would result in Javascript thinking it is a string. Thanks, Javascript!

There are no tests here yet since this makes use of an external library Chart.js.
2024-08-28 19:24:57 +08:00
Jarek Radosz 480f26a2c2
DEV: Await for ace render in tests (#28586)
Why all the manual setting of `width` and `height`? Without it all ace editors were 0x0, invisible.

Why didn't it affect the tests before? ace-editor tests only confirms that there is an element, theme-settings-editor tests were effectively unit tests before 7317b5a, fk-code test avoids interacting with ace.
2024-08-28 11:24:30 +02:00
Martin Brennan 4f0fe92195
UX: Add group link to category permission row (#28560)
Makes it easier to reach the group from the category security
tab, and moves the trash button to the right to avoid misclicks.

Also converts the category permission row to gjs
2024-08-28 16:11:16 +10:00
Jarek Radosz 6136a275dd
DEV: Fix an `on` import deprecation (#28588) 2024-08-27 21:56:04 +02:00
Kris ade898a7ca
UX: fix spacing in topic map views menu (#28583) 2024-08-27 13:23:03 -04:00
Jarek Radosz 7317b5a120
DEV: Update theme-settings-editor tests (#28582)
Convert them to proper integration tests.
2024-08-27 18:47:24 +02:00
Penar Musaraj ee3b175373
DEV: Ignore invalid tag parameter in TagsController (#28557)
This had no effect in the app, but it was resulting in errors in the logs.
2024-08-27 12:06:54 -04:00
David Taylor 7bf3727663
DEV: Convert core components to native class syntax (batch 3) (#28517)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-27 15:28:08 +01:00
Jarek Radosz 9b83ae7d55
DEV: Update ace-editor tests, minor tweaks to component (#28579) 2024-08-27 16:27:52 +02:00
David Taylor 66b061a5a8
DEV: Convert core components to native class syntax (batch 2) (#28515)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-27 15:00:46 +01:00
dependabot[bot] 92f03a1108
Build(deps-dev): Bump @ember/test-helpers from 3.3.1 to 4.0.2 (#28533)
* Build(deps-dev): Bump @ember/test-helpers from 3.3.1 to 4.0.2

Bumps [@ember/test-helpers](https://github.com/emberjs/ember-test-helpers) from 3.3.1 to 4.0.2.
- [Release notes](https://github.com/emberjs/ember-test-helpers/releases)
- [Changelog](https://github.com/emberjs/ember-test-helpers/blob/master/CHANGELOG.md)
- [Commits](https://github.com/emberjs/ember-test-helpers/commits)

---
updated-dependencies:
- dependency-name: "@ember/test-helpers"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* add loader shim

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Taylor <david@taylorhq.com>
2024-08-27 14:08:01 +01:00
Jan Cernik 437d7a0ad1
FIX: Endless loading post history (#28425) 2024-08-27 09:33:13 -03:00
dependabot[bot] d05d23f947
Build(deps): Bump @ember/string from 3.1.1 to 4.0.0 (#28564) 2024-08-27 13:31:12 +01:00
Joffrey JAFFEUX b4a8873596
DEV: changes identifier from card to usercard (#28575) 2024-08-27 14:08:49 +02:00
Jarek Radosz 62c8904721
DEV: Convert ace-editor to glimmer/gjs (#28492) 2024-08-27 13:35:38 +02:00
Alan Guo Xiang Tan 4a6fc45429
DEV: Migrate `User#seen_notification_id` to `bigint` (#28572)
`Notification#id` was migrated to `bigint` in 799a45a291
2024-08-27 14:32:55 +03:00
Bianca Nenciu b11d901e12
DEV: Migrate user_badges#notification_id to bigint (#28546)
The `notifications.id` has been migrated to bigint in previous commit
799a45a291. This commit migrates one of
the related columns, `user_badges.notification_id`, to `bigint`.
2024-08-27 11:46:48 +08:00
Alan Guo Xiang Tan c4ba4c5742
DEV: Fix annotations (#28569)
Follow-up to ec8ba5a0b9
2024-08-27 11:15:03 +08:00
Bianca Nenciu ec8ba5a0b9
DEV: Migrate shelved_notifications#notification_id to bigint (#28549)
DEV: Migrate shelved_notifications#notification_id to bigint

The `notifications.id` has been migrated to `bigint` in previous commit
799a45a291.
2024-08-27 10:56:00 +08:00
Osama Sayegh 6161b1796b
DEV: Change number of displayed admins/mods on the new about page to 6 (#28566)
This commit changes the cutoff number for the admins and mods lists on the new /about page from 12 to 6. If the admins or mods lists are bigger than 6, the about page will display the 6 most recently seen admins/mods, and tuck the rest away behind a "view more" button.
2024-08-27 04:57:46 +03:00
chapoi 1ed90c4d6b
UX: fix overflow usercard (#28558) 2024-08-27 01:47:55 +02:00
Krzysztof Kotlarek df6c152fa1
UX: flag settings tab to follow UI guidelines (#28479)
Add settings tab to flags moderation page.
2024-08-27 09:47:19 +10:00
Joffrey JAFFEUX fbc485c218
FIX: correctly shortcut format on mac (#28556)
On windows + are shown between keys, not on mac. The fix was to wrap the whole shortcut in `translateModKey`.
2024-08-26 14:58:23 -04:00
Penar Musaraj fe3d82a44a
FIX: Respect the End key when last post is already rendered (#28524)
Given we are a single-page-app, we hijack the browser's default behavior
for keyboard shortcuts like End because on long topics (20+ posts) we
need to load the last post before really reaching the end of the page.

However, when the last post is already rendered, the End shortcut
currently does nothing, it takes the user to the start of the last post.
If that post is too long, the user will have to scroll down manually.

This change ensures that if the last post of a topic is already rendered
(whether it is in the viewport or not), pressing End will take the user
to the very bottom of the page.

Note for the reviewer: the test added here is for the general case, it
is too hard to test the case where the last post is already rendered,
that isn't covered here.
2024-08-26 14:39:30 -04:00
Joffrey JAFFEUX 27f08a5c28
FIX: allows to manually remove error for virtual fields (#28555)
In FormKit you can add error on an existing field existing in the DOM, but you can also set an arbitrary error on a virtual field not existing in the DOM.

When revalidating existing data, we are only resetting real fields. This commit adds `removeError(name)` to allow you to manually manage virtual fields. `removeError` is available in the same helpers where `addError` is available.

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2024-08-26 20:32:46 +02:00
Joffrey JAFFEUX d62c32ba71
FIX: allows selectText to take a scroll position as opt (#28554)
Prior to this fix using:

- `replaceText(...)`
- `selectText(..., ..., { scroll: true})`

Wouldn't have the expected behaviour as the scroll from selectText will attempt to save the scroll position and restore it AFTER the replacement happened. This commit allows scroll to be a Boolean or a Number, when a number, it will be used to restore the scrollTop position.

I tried to write tests for this specific behavior but couldn't reproduce the issue in tests.
2024-08-26 18:32:52 +02:00
dependabot[bot] 0e7d5b712a
Build(deps-dev): Bump ember-cli-deprecation-workflow from 3.0.1 to 3.0.2 (#28472)
Bumps [ember-cli-deprecation-workflow](https://github.com/ember-cli/ember-cli-deprecation-workflow) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/ember-cli/ember-cli-deprecation-workflow/releases)
- [Changelog](https://github.com/ember-cli/ember-cli-deprecation-workflow/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli-deprecation-workflow/commits)

---
updated-dependencies:
- dependency-name: ember-cli-deprecation-workflow
  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>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2024-08-26 18:18:20 +02:00
Jan Cernik b0f6d074be
FIX: Destroy draft when clicking the Discard button (#28552) 2024-08-26 12:49:26 -03:00
Jarek Radosz 58d687a92e
DEV: "Downgrade" `@ember/string` from 4.x to 3.x (#28553)
A follow-up to dd1abf91ef.

Because `ember-cli-deprecation-workflow` relied on `@ember/string` 3.1.1, that was the effective version used in the app.

Turns out there's a compatiblity issue with 4.0.0. Let's lock it to 3.x so we can easily update deprecation-workflow and then we can look into the ember/string issue.
2024-08-26 17:48:40 +02:00
chapoi 2664300a12
UX: DMenu fixes (#28551) 2024-08-26 17:06:45 +02:00
Osama Sayegh 5eea7244c7
FIX: Add users to user directory on account activation (#28505)
Follow-up to e3ae57ea7a

The previous commit added an `after_create` callback that triggers a refresh for the user directory whenever a `User` record is created. Theoretically, this approach should work, however, there's a gotcha in practice, because during a real user registration, when the `User` record is created in the database, it's not marked as active until the user verifies their email address and the user directory excludes inactive users, so the initial directory refresh triggered by the `after_create` callback becomes pointless.

To make a new user appear in the user directory immediately after sign up, we need to trigger a refresh via an `after_save` callback when they verify their email address and become active.
2024-08-26 18:01:24 +03:00
Loïc Guitaut cda596601b FIX: Return properly interpolated translations for flags
Currently, `FlagSerializer#short_description` properly provides
`base_path` to its translations, but `FlagSerializer#description` does
not. This breaks the link to guidelines when flagging a post, for
example.

This patch provides `base_path` for `FlagSerializer#description` too.
2024-08-26 16:46:30 +02:00
Jarek Radosz dd1abf91ef
DEV: Add missing `@ember/string` dependencies (#28547)
All those addons import it but didn't have it in their package.jsons. And because the only thing that had it as a dependency (ember-cli-deprecation-workflow) removed it in the latest version, the build breaks.

File it under: a problem we wouldn't have with pnpm :P
2024-08-26 15:48:01 +02:00
dependabot[bot] db8e0a02f1
Build(deps): Bump @babel/standalone in the babel group (#28532)
Bumps the babel group with 1 update: [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/standalone` from 7.25.4 to 7.25.5
- [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.25.5/packages/babel-standalone)

---
updated-dependencies:
- 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-08-26 14:13:24 +02:00
Joffrey JAFFEUX f7990ec8f6
FIX: prevents topic hot scope error on future topics (#28545)
Prior this fix a topic created in the future could generate this exception:

```
Job exception: ERROR:  a negative number raised to a non-integer power yields a complex result
```

This fix and spec should ensure we don't consider topics in the future as the rest of the `update_scores` function is doing at other places.
2024-08-26 14:07:31 +02:00
锦心 a2dbade55d
FIX: Prevent group requests from loading infinitely (#28544)
In GroupRequestsController, request_count is incorrectly written as
user_count, which causes group member requests to be loaded infinitely
when user_count is greater than request_count.
2024-08-26 17:54:30 +08:00
Joffrey JAFFEUX 3eb7aa866c
FIX: prevents exception when showing replacements (#28543) 2024-08-26 11:37:12 +02:00
Ted Johansson 981110d96e
FIX: Fix incorrect check for required custom fields (#28541)
This check was checking the wrong scope, causing problems in certain edge conditions, for example:

1. Admin adds an "on signup" field that isn't editable after signup.
2. Admin adds a "for all users" field.
3. User goes and fills up the "for all users" field from 2.
4. User is now stuck on the required fields page without any fields showing.

With this change, we only consider "for all users" fields when asking if required custom fields are filled in.
2024-08-26 15:33:19 +08:00
David Battersby 910bfaf5f5
FIX: prevent desktop notification callbacks on mobile (#28527) 2024-08-26 15:49:49 +10:00
Sam e25578d702
FIX: when replacing text in composer maintain history (#28537)
Replacing value in the composer will not maintain history, this migrates
us to the new pattern used throughout this file
2024-08-26 14:25:31 +10:00
Bianca Nenciu 799a45a291
DEV: Migrate notifications#id to bigint (#28444)
The `notifications.id` column is the most probable column to run out of
values. This is because it is an `int` column that has only 2147483647
values and many notifications are generated on a regular basis in an
active community. This commit migrates the column to `bigint`.

These migrations do not use `ALTER TABLE ... COLUMN ... TYPE` in order
to avoid the `ACCESS EXCLUSIVE` lock on the entire table. Instead, they
create a new `bigint` column, copy the values to the new column and
then sets the new column as primary key.

Related columns (see `user_badges`, `shelved_notifications`) will
be migrated in a follow-up commit.
2024-08-26 09:35:12 +08:00
Martin Brennan a16faa27cd
FEATURE: Allow showing site text search in selected locale (#28453)
When searching for site texts for admin using the english
version of the text, previously we would show the english
version in the results _even if_ there was another locale
translated version available when a locale was selected
from the dropdown.

This commit adds a "Only show results in selected locale"
checkbox option which will instead make it so the results
shown are in the target locale, making it easier for translators
to tell when there is actually translations vs. missing tranlsations.
2024-08-26 11:25:36 +10:00
dependabot[bot] d83ada23b9
Build(deps-dev): Bump @swc/core from 1.7.14 to 1.7.18 (#28534)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.14 to 1.7.18.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.14...v1.7.18)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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-08-26 08:48:17 +08:00
Martin Brennan e58e7a49f5
FIX: Bookmark reminder was clearing incorrectly (#28506)
Followup 76c56c8284

The change introduced above made it so the expired
bookmark reminders were cleared when using the bulk
action menu for bookmarks. However this also affected
clearing reminders for bookmarks when sending notifications.

When clearing bookmark reminders after sending notifications,
we take into account the auto delete preference:

* never          - The bookmark `reminder_at` date should not be cleared,
                   and the bookmark is kept.
* clear_reminder - The bookmark `reminder_at` date is cleared and
                   the bookmark is kept

The `never` option made it so "expired" bookmark reminder show
on the user's bookmark list.

This commit fixes the change from the other commit and only
forces clearing of `reminder_at` if using the bookmark bulk
action service.
2024-08-26 09:17:39 +10:00
Blake Erickson 274e18622e
FIX: Video uploads sometimes hang indefinitely (#28523)
If there is a codec issue or something trying to process a video file
for thumbnail generation, uploads could hang indefinitely. This fix
  ensures that we continue the upload process even if we encounter an
  error trying to generate a thumbnail for it.
2024-08-23 15:58:54 -06:00
Keegan George b1a369ab13
UX: Make keyboard shortcut styling more subtle (#28522) 2024-08-23 13:31:53 -07:00
Osama Sayegh a7cd523faf
FIX: Refresh the edit tag section when navigating to another tag (#28519)
If you’re viewing a tag and you switch to a different tag via the sidebar or the tags dropdown, after expanding the info section of the tag page via the wrench button, the info section keeps showing the previous tag's details instead of the new one.

This happens because the tag info section makes an ajax request to load the tag's details, and this request is made inside the `didInsertElement` hook which is only fired once when the component is rendered. To fix this, we need to set the result from the ajax request to null and add a `didUpdateAttrs` hook to trigger another request to load the info of the new tag.

Internal topic: t/134809.
2024-08-23 20:08:24 +03:00
chapoi 208007d9a0
UX: centralise DMenu mobile styling + fixes (#28469) 2024-08-23 17:56:35 +02:00
Jarek Radosz 5a8e7c5f29
DEV: Convert admin charts to glimmer/gjs (#28271) 2024-08-23 14:59:56 +02:00
Joffrey JAFFEUX fee8caf529
FIX: correctly reset form before destroying it (#28516)
This change is preventing the "is dirty check" from happening when clicking delete on this form. This was not good UX and was also causing bugs by leaving the form in a unexpected state.
2024-08-23 14:58:31 +02:00
David Taylor fe6c91daa3
DEV: Convert select-kit subclasses to native class syntax (#28491)
This covers all select-kit subclasses in core and core plugins

Followup to https://github.com/discourse/discourse/pull/28489
2024-08-23 13:19:26 +01:00
David Taylor 87ae3f689c
DEV: Convert mapping-router to native class syntax (#28513) 2024-08-23 12:58:19 +01:00
David Taylor d1cc60c435
DEV: Convert select-kit components to native class syntax (#28489)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-23 12:17:07 +01:00
Joffrey JAFFEUX 2829b670f9
DEV: adds support for replaceText in toolbarEvent (#28512)
This function was available in textarea manipulation mixin, but not exposed as other functions like addText, applySurround, ...
2024-08-23 11:44:27 +02:00
Alan Guo Xiang Tan 21bb28df91
PERF: Ensure suggested topics is only loaded on last page of topic view (#28507)
This commit improves `TopicsController#show` to not load suggested and
related topics unless it is the last page of the topic's view.
Previously, we avoided loading suggested and related topics by the use
of conditionals in the `TopicViewSerializer` to avoid calling
`TopicView#suggested_topics` and `TopicView#related_topics`. However,
this pattern is not reliable as the methods can still be called from
other spots in the code base. Instead, we ensure that
`TopicView#include_suggested` and `TopicView#include_related` is set
correctly on the instance of `TopicView` which ensures that for the
given instance, `TopicView#suggested_topics` and
`TopicView#related_topics` will be a noop.
2024-08-23 16:10:50 +08:00
dependabot[bot] 1ac7482271
Build(deps): Bump @babel/standalone in the babel group (#28500)
Bumps the babel group with 1 update: [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone).


Updates `@babel/standalone` from 7.25.3 to 7.25.4
- [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.25.4/packages/babel-standalone)

---
updated-dependencies:
- 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-08-23 01:51:58 +02:00
dependabot[bot] cd4efb8d68
Build(deps-dev): Bump webpack from 5.93.0 to 5.94.0 (#28501)
Bumps [webpack](https://github.com/webpack/webpack) from 5.93.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.93.0...v5.94.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-08-23 01:51:21 +02:00
Sam 7ab7e6bb23
FEATURE: allow plugins to specify keyboard shortcuts for hidden toolbar items (#28456)
Previous to this change there is no clean way to apply keyboard shortcuts
to things such as "add poll" and other hidden options in the toolbar

This allows shortcuts to be specified similar to how they are on the toolbar



Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
2024-08-23 09:28:28 +10:00
Joffrey JAFFEUX eb70b3bc93
DEV: adds more fields to topic fabricator (#28497) 2024-08-22 23:01:17 +02:00
Kris ecc2ffc78a
UX: adjust software update banner for headerless pages (#28496) 2024-08-22 16:51:26 -04:00
Kris 828c34451e
UX: don't use split subcategory color in docked header (#28494) 2024-08-22 16:36:59 -04:00
Kris fd4f7868ca
UX: fix textarea height on mobile (#28495) 2024-08-22 16:31:48 -04:00
Blake Erickson b53df4d884
FIX: Videos not uploading due to thumbnail generation error (#28493)
If we don't get a `videoWidth` back for a video don't try and generate a
thumbnail for it.

Also as part of this change I switched getImageData, the function
throwing the error, to use video.videoWidth instead of canvas.width
because it's very likely we were setting canvas.width too early before
the width could be read. Now that we are reading the value inside of the
setTimeout hopefully we will actually have a width. Just incase we don't
detect a width we will now exit early instead of throwing an error.

We only need to check for `0` and not null because the value is an
integer and will always return a 0 if it can't be read. https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement/videoWidth

See https://meta.discourse.org/t/322363
2024-08-22 13:35:18 -06:00
David Taylor 5fa0496f81
DEV: fixup select-kit pluginApiIdentifiers typo (#28487)
Followup to 3e3c051164
2024-08-22 16:36:24 +01:00
Osama Sayegh 67cde14a61
DEV: Use `Service::Base` for suspend and silence actions (#28459)
This commit moves the business logic in the `Admin::UsersController#suspend` and `Admin::UsersController#silence` actions to dedicated service classes. There's no functional changes in this commit.

Internal topic: t/130014.
2024-08-22 14:38:56 +03:00
Osama Sayegh 6997b3c5ce
FIX: Hide heading when there's no custom description (#28470)
In the new /about page, when there's no extended description provided by the admin, the "About" heading above the description should not be displayed.
2024-08-22 13:47:19 +03:00
dependabot[bot] 9d367cc9a1
Build(deps): Bump ace-builds from 1.35.5 to 1.36.0 (#28471)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.5 to 1.36.0.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.35.5...v1.36.0)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  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-08-22 12:22:31 +02:00
Joffrey JAFFEUX 905b4f900e
DEV: adds tag to core fabricators (#28480) 2024-08-22 10:49:00 +02:00
David Taylor c91dcd0447
DEV: Convert core components to native class syntax (batch 1) (#28465)
Changes made using the ember-native-class-codemod, plus some manual tweaks
2024-08-22 09:39:28 +01:00
David Taylor 3e3c051164
DEV: Convert select-kit base classes to native class syntax (#28467)
This lays the groundwork for converting SelectKit subclasses to native class syntax. This commit is designed to be entirely backwards-compatible, so it should not affect any existing subclasses.

Of interest:

- Any properties which are designed to be overridden by subclasses are implemented using a local `@protoProp` decorator. That means they are applied to the prototype, so that they can be overridden in subclasses by both legacy `.extend()` prototype extensions, and by modern native-class fields.

- New class decorators are introduced: `@selectKitOptions` and `@pluginApiIdentifiers`. These are native class versions of the legacy `concatenatedProperties` system. This follows the pattern Ember has introduced for `@className`, `@classNameBindings`, etc.
2024-08-22 09:39:03 +01:00
Martin Brennan ebbe23e4d2
UX: Add title token for What's New admin page (#28476)
Followup e60b808f49,
I missed adding it here.
2024-08-22 14:36:32 +10:00
Martin Brennan e60b808f49
UX: Apply new admin UI guidelines to What's New (#28454) 2024-08-22 10:28:29 +10:00
Joffrey JAFFEUX 5eca77dd70
FIX: ensures href is not set two times (#28466)
This would cause the infamous error:

```
index.js:118 Uncaught (in promise)
Error: Assertion Failed: You attempted to update `href` on `<ExtraNavItem:ember384>`, but it had already been used previously in the same computation.
```

Moreover, set didnt seem necessary here.
2024-08-21 20:27:21 +02:00
Renato Atilio 676f0897ac
FIX: subfolder account activation (#28463) 2024-08-21 13:50:38 -03:00
Kris 70ea3f8fcd
UX: improve mention colors for dark color schemes (#28462) 2024-08-21 11:45:48 -04:00
Jarek Radosz cee2605d88
FIX: Lost outer context in `#each` block in hbr (#28461)
Regressed 3.5 years ago in e80332a2bc :P
2024-08-21 17:11:36 +02:00
Osama Sayegh b69a7ea824
FIX: Specify `@type` arg for the image uploader in the about config area (#28460)
Specifying the type is required for the uploader to work on sites that use S3 uploads.
2024-08-21 16:35:32 +03:00
David Taylor 150f5694dc
FIX: Write stylesheet cache atomically (#28457)
In some situations, the filesystem cache will be read and persisted to the database. If the file being read is still being written, then that can lead to empty/partial caches being stored in the database.

This commit ensures that cannot happen by switching to our `atomic_write_file` helper (which writes to a temp file, and then does an atomic `mv` operation to move it to the destination)
2024-08-21 12:44:17 +01:00
Martin Brennan 9dd47ca755
UX: Fix restore info link on admin backups page (#28452)
Followup 1446596089

The link to inform admins that restore is disabled
was not correct. This fixes it and also changes it
to go to /admin/backups/settings
2024-08-21 13:23:24 +10:00
Martin Brennan 8632ea5a63
UX: Apply admin UI guidelines to custom flags (#28433)
This commit changes the custom flags admin config area
to use the AdminPageHeader component and conforms
to the new admin UI guidelines. Also makes some slight
modifications to the reusable components to handle using
a @route for an action button.
2024-08-21 10:42:00 +10:00
dependabot[bot] e1855da40d
Build(deps-dev): Bump ember-cli from 5.10.0 to 5.11.0 (#28449)
Bumps [ember-cli](https://github.com/ember-cli/ember-cli) from 5.10.0 to 5.11.0.
- [Release notes](https://github.com/ember-cli/ember-cli/releases)
- [Changelog](https://github.com/ember-cli/ember-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli/compare/v5.10.0...v5.11.0)

---
updated-dependencies:
- dependency-name: ember-cli
  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-08-21 00:54:06 +02:00
dependabot[bot] 3d217dc6b3
Build(deps): Bump ace-builds from 1.35.4 to 1.35.5 (#28450)
Bumps [ace-builds](https://github.com/ajaxorg/ace-builds) from 1.35.4 to 1.35.5.
- [Release notes](https://github.com/ajaxorg/ace-builds/releases)
- [Changelog](https://github.com/ajaxorg/ace-builds/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ajaxorg/ace-builds/compare/v1.35.4...v1.35.5)

---
updated-dependencies:
- dependency-name: ace-builds
  dependency-type: direct:production
  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-08-21 00:52:25 +02:00
Sérgio Saquetim 649cbad216
DEV: Use the glimmer header in the Styleguide (#28427) 2024-08-20 19:44:26 -03:00
Osama Sayegh eb0b2c9308
FIX: Use correct subtitle for Site contact name field (#28448)
A copy-and-paste error resulted in using the wrong subtitle for the "Site contact name" field in the admin config area for the /about page.
2024-08-21 01:21:49 +03:00
Kris 6c159241c9
UX: view count in topic map should always be at least 1 (#28447) 2024-08-20 17:26:09 -04:00
Osama Sayegh 10ae7ef44a
FEATURE: Add estimated number of global and EU visitors to the about page (#28382)
This commit implements 2 new metrics/stats in the /about page for the _estimated_ numbers of unique visitors from the EU and the rest of the world. This new feature is currently off by default, but it can be enabled by turning on the hidden `display_eu_visitor_stats` site settings via the rails console.

There are a number of assumptions that we're making here in order to estimate the number of unique visitors, specifically:

1. we're assuming that the average of page views per anonymous visitor is similar to the average number of page views that a logged-in visitor makes, and
2. we're assuming that the ratio of logged in visitors from the EU is similar to the ratio of anonymous visitors from the EU

Discourse keeps track of the number of both logged-in and anonymous page views, and also the number of unique logged-in visitors and where they're from. So with those numbers and the assumptions above, we can estimate the number of unique anonymous visitors from the EU and the rest of the world.

Internal topic: t/128480.
2024-08-21 00:03:42 +03:00
Mark VanLandingham 9802d4040f
DEV: Add class to span wrapping `after-topic-list` plugin outlet (#28445) 2024-08-20 14:08:06 -05:00
Ted Johansson 948e7bd55e
DEV: Allow disabling problem checks programatically (#28440)
We need a way to disable certain checks programatically, e.g. on Discourse hosting. This PR adds a configuration option for this, and makes it so that disabled checks aren't run as part of #run_all.
2024-08-20 16:42:06 +02:00
Loïc Guitaut 0636855706 DEV: Allow using an AR relation as a model in services
This patch allows using an AR relation as a model in services without
fetching associated records. It will just check if the relation is empty
or not. In the former case, the execution will stop at that point, as
expected.
2024-08-20 16:32:46 +02:00
Osama Sayegh db6eff7be9
DEV: Allow custom site activity items in the new /about page (#28400)
This commit introduces a new frontend API to add custom items to the "Site activity" section in the new /about page. The new API is called `addAboutPageActivity` and it works along side the `register_stat` serve-side API which serializes the data that the frontend API consumes. More details of how the two APIs work together is in the JSDoc comment above the API function definition.

Internal topic: t/128545/9.
2024-08-20 16:16:05 +03:00
Joffrey JAFFEUX ccb1861ada
DEV: better highlighting of mentions (#28403)
This commit improves the hilight-ing of mentions in posts and chat messages.

- `@here` and `@all` will generate a `<a class="mention --wide">`
- bots will generate a `<a class="mention --bot">`
- current user will generate a `<a class="mention --current">`

To achieve this change the following value transformer has been added: "mentions-class". It will be run in posts and chat messages after the mention is rendered.

A bug were bots were not considered in mentioned users has also been fixed as part of this PR.
2024-08-20 14:37:28 +02:00
Osama Sayegh 35b748e7f4
FIX: Don't show silence button on staff users and display similar users (#28423)
This commit fixes a bug where the silence button is incorrectly displayed on the admin page of a staff user. It's not actually possible to silence a staff user because the backend correctly prevents it, but the frontend isn't checking if the button should be displayed.

Another small bug that this commit fixes is the similar users list not showing up inside the silence/suspend modals due to also a bug in the frontend.

I've also changed the way similar users are loaded so that they're not returned by the `admin/users#show` endpoint anymore and moved them into a new endpoint that the penalize modals (suspend and silence) can call directly to retrieve the list of users. This is done because the similar users list is never shown on the admin user page (`/admin/users/:user_id/:username`); they're only needed when the suspend or silence modals are opened.

Internal topic: t/130014.
2024-08-20 15:27:29 +03:00
dependabot[bot] 08463a9db2
Build(deps): Bump a11y-dialog from 8.0.4 to 8.1.0 (#28418)
Bumps [a11y-dialog](https://github.com/KittyGiraudel/a11y-dialog) from 8.0.4 to 8.1.0.
- [Release notes](https://github.com/KittyGiraudel/a11y-dialog/releases)
- [Commits](https://github.com/KittyGiraudel/a11y-dialog/compare/8.0.4...8.1.0)

---
updated-dependencies:
- dependency-name: a11y-dialog
  dependency-type: direct:production
  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-08-20 12:00:41 +02:00
锦心 070025204d
DEV: add addError method to FormKit onRegisterApi (#28436)
This commit adds the addError method to From's onRegisterApi to allow
parent components to add errors to a field.
2024-08-20 17:22:36 +08:00
dependabot[bot] b42d6faef5
Build(deps-dev): Bump @swc/core from 1.7.11 to 1.7.14 (#28424)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.11 to 1.7.14.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.11...v1.7.14)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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-08-20 13:07:51 +08:00
David Taylor dfc947a97d
PERF: Defer button actions to improve interaction-next-paint (INP) (#28019)
This is a variation on bc3e8a9963cf9a64d114ec751c875025af169690, which was reverted due to issues on iOS. Safari's "in response to user action" check cannot follow the `runAfterFramePaint` chain of interaction -> requestAnimationFrame -> messageChannel, and so some sensitive browser APIs (e.g. clipboard, upload, etc.) were blocked.

This commit is similar, but uses `next()` instead of `runAfterFramePaint()`. The result seems the same, but doesn't have the same issue on iOS.

The chat-emoji-picker change was required to resolve a test failure. The emoji picker has never closed-on-scroll on desktop, so there is no user-facing change in behavior.
2024-08-20 10:11:34 +08:00
Martin Brennan 1446596089
UX: Apply admin interface guidelines to Backups page (#28051)
This commit converts the Backups page in the admin interface
to follow our new admin interface guidelines.

As part of this work, I've also made `AdminPageHeader` and `AdminPageSubheader`
components that can be reused on any admin page for consistency, that handle
the title and action buttons and also breadcrumbs.

Also renamed `AdminPluginFilteredSiteSettings` to `AdminFilteredSiteSettings` since
it can be used generally to show a subset of filtered site settings, not only
settings for a plugin. Not sure if it's ideal to have to define a new route for this
for every config area, but not sure how else to do it right now.
2024-08-20 09:59:43 +10:00
Joffrey JAFFEUX 5b17e85fe1
FIX: broken mentioned users with capitalized usernames (#28421)
This commit fixes two codepaths which where incorrectly working with capitalized usernames as we were doing a mix of username_lower and non lower username.

Also adds two specs for these cases.
2024-08-19 20:57:45 +02:00
Gerhard Schlager 0826e021e4
PERF: Delete `I18n._overrides` after they have been applied (#28405)
There's no need to keep them around. This might just bloat memory if there are lots of translation overrides.
2024-08-19 14:11:04 +02:00
Gerhard Schlager 7b8855a698
FIX: Translation overrides didn't work for search orders (#28404)
The `SortOrders` were cached before translation overrides were applied on the client.
2024-08-19 14:10:29 +02:00
Martin Brennan 31a6d24053
FEATURE: Unseen feature indicator in admin sidebar (#28397)
This commit adds a blue dot next to the "What's New"
link in the admin sidebar if the user has not seen the
new features yet, as a followup to 3e5976f843
which removed the tab on the dashboard that had this same
functionality.

When the admin visits the "What's New" page they count
as having seen all the features straight away. This could
be something we want to change, but for now this keeps the
same functionality.
2024-08-19 14:50:30 +10:00
dependabot[bot] 32195ed77e
Build(deps-dev): Bump qunit from 2.21.1 to 2.22.0 (#28415)
Bumps [qunit](https://github.com/qunitjs/qunit) from 2.21.1 to 2.22.0.
- [Release notes](https://github.com/qunitjs/qunit/releases)
- [Changelog](https://github.com/qunitjs/qunit/blob/main/History.md)
- [Commits](https://github.com/qunitjs/qunit/compare/2.21.1...2.22.0)

---
updated-dependencies:
- dependency-name: qunit
  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-08-19 01:01:47 +02:00
Joffrey JAFFEUX e7b7886d83
DEV: removes route action usage from sidebar footer (#28408)
`routeAction` is an old and bad pattern we don't want to have in the codebase anymore.


Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2024-08-17 17:45:18 +02:00
Joffrey JAFFEUX 3e69f31e0b
DEV: migrates webhook-status to gjs (#28407)
This commit also adds a test for this component.

---------

Co-authored-by: Jarek Radosz <jarek@cvx.dev>
2024-08-17 17:44:56 +02:00
Joffrey JAFFEUX ea8516b38d
DEV: prevents route action to crash in tests (#28409)
`routeAction` is testing at runtime that a route exists when in debug mode. However in the case of components tested in isolation there's no existing route which was causing an exception, this commit prevents this check in this case as it's irrelevant.
2024-08-17 13:52:20 +02:00
Osama Sayegh 2f8dc64caf
UX: Improve mobile view for the new /about page (#28406)
This commit makes the new /about page look better on mobile.
2024-08-17 03:44:18 +03:00
Renato Atilio 5e91233ca9
UX: omit fav badges count if max is 0 (#28402) 2024-08-16 16:42:10 -03:00
Guhyoun Nam 9c1812e071
FEATURE: add `system_user_max_attachment_size_kb` site setting (#28351)
* System user attachment size WIP

* spec check

* controller update

* add max to system_user_max_attachment_size_kb

* DEV: update to use static method for `max_attachment_size_for_user`

add test to use large image.
add check for failure.

* DEV: update `system_user_max_attachment_size_kb` default value to 0

remove unecessary test.
update tests to reflect the new default value of `system_user_max_attachment_size_kb`

* DEV: update maximum_file_size to check when is an attachment made by a system user

Add tests for when `system_user_max_attachment_size_kb` is over and under the limit
Add test for checking interaction with `max_attachment_size_kb`

* DEV: move `max_attachment_size_for_user` to private methods

* DEV: turn `max_attachment_size_for_user` into a static method

* DEV: typo in test case

* DEV: move max_attachment_size_for_user to private class method

* Revert "DEV: move max_attachment_size_for_user to private class method"

This reverts commit 5d5ae0b715.

---------

Co-authored-by: Gabriel Grubba <gabriel@discourse.org>
2024-08-16 11:03:39 -03:00
Joffrey JAFFEUX a59c89211b
FIX: bypass highlighths for long code in auto mode (#28399)
Long code is considered 1000 characters atm. 10000+ characters would take seconds due to how highlightjs will consider every installed lang before choosing the best candidate.
2024-08-16 14:25:19 +02:00
Jarek Radosz 6cc100abe0
DEV: Move user-profile-secondary outlet (#28398)
Move it into the preceding `dl` element and remove the `div` wrapper.

The two plugins that use this outlet:
* d-follow - actually jumps through hacky hoops to get its elements into that `dl` anyway
* d-gamification - would look better if its element was in that `dl`
2024-08-16 13:47:52 +02:00
Martin Brennan c120c446da
DEV: Cleanup empty method in job (#28395)
Followup 624dc87321
2024-08-16 14:10:46 +08:00
chapoi 931485b7c1
DEV: replace list control nav dropdown with DMenuMobile (#28324)
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
Co-authored-by: Renato Atilio <renato@discourse.org>
Co-authored-by: David Taylor <david@taylorhq.com>
2024-08-16 01:40:47 +02:00
Martin Brennan 3e5976f843
FEATURE: Always show full page "New Features" to admins (#28383)
We used to show New Features in a tab on the dashboard,
but this could get pushed down the page especially on
our hosting. In 043117ca13
we made a separate What's New page, so this commit removes
the dashboard tab and changes the admin notification to
send the admin to /admin/whats-new instead of the dashboard
tab.
2024-08-16 09:12:24 +10:00
Kris 43abc219d1
DEV: give sidebar link buttons a data-list-item-name (#28389) 2024-08-15 17:44:37 -04:00
Osama Sayegh a92cf019db
FIX: Make cancel and reset buttons work for `file_size_restriction` settings (#28347)
This commit fixes a number of bugs in `file_size_restriction` settings and does a little of refactoring to reduce duplicated code in site setting types (the refactoring is necessary to fix one of the bugs).

The bugs in `file_size_restriction` settings that are fixed in this commit:

1. Save/cancel buttons next to a `file_size_restriction` setting are shown upon navigating to the settings page without changes being made to the setting
2. Cancel button that discards changes made to the setting doesn't work
3. Reset button that resets the setting to its default doesn't work
4. Validation error message isn't cleared when resetting/cancelling changes

To repro those bugs, navigate to `/admin/site_settings/category/files` and observe the top 2 settings in the page (`max image size kb` and `max attachment size kb`).

Internal topic: t/134726.
2024-08-15 19:38:47 +03:00
Kris b545576b3c
UX: do not check for dimensions in video filename (#28349) 2024-08-15 11:59:13 -04:00
Mark VanLandingham 1ca06e1283
UX: Style reviewables in the user menu when avatars are enabled (#28388) 2024-08-15 10:26:36 -05:00
David Battersby de08ce8f7b
FIX: allow chat sound when notifications are disabled (#28385)
Desktop chat notification sounds have stopped working on most desktop browsers.

This is due to Notifications API being disabled when Push Notifications are supported in the browser, which means that we never iterate on the desktopNotificationHandlers and trigger the callback since we return early.
2024-08-15 18:30:55 +04:00
dependabot[bot] 10c6a761b3
Build(deps-dev): Bump @swc/core from 1.7.10 to 1.7.11 (#28379)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.10 to 1.7.11.
- [Release notes](https://github.com/swc-project/swc/releases)
- [Changelog](https://github.com/swc-project/swc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/swc-project/swc/compare/v1.7.10...v1.7.11)

---
updated-dependencies:
- dependency-name: "@swc/core"
  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-08-15 14:58:50 +02:00
Kris 8cd42de2ef
DEV: add before-sidebar-sections outlet to dropdown mode too (#28376) 2024-08-14 16:25:58 -04:00
Sérgio Saquetim 49449531de
DEV: Accept new transformer names after resetting to a new test (#28375) 2024-08-14 16:05:46 -03:00
Roman Rizzi 636d05fc20
FEATURE: Allow completely custom score reasons. (#28348)
After this change, a reason won't exclusively be a translation key anymore, but now, it can display a custom reason as well.
2024-08-14 15:53:59 -03:00
David Taylor b7b233423d
DEV: Fix ordering of `freeze-valid-transformers` (#28374)
plugins/themes need to use `withPluginApi` to register transformers, and that only works after `discourse-bootstrap` has been run
2024-08-14 18:22:48 +01:00
David Taylor ede6220347
UX: Only `scrollIntoView` if sidebar items are not already visible (#28372)
When browsing through a sidebar with this feature enabled (i.e. admin, or docs), it's weird to have the scroll jump around when you click an item. This commit adds a check, so that we only `scrollIntoView` for items which are not already in the viewport.

Followup to b7cce1a0dc
2024-08-14 15:58:11 +01:00
Ted Johansson d15031a219
DEV: Add plugin outlet for below wizard field (#28371)
We changed the design of the member access wizard step to use toggle groups instead of switches. To support existing designs for notices, we need another plugin outlet.
2024-08-14 15:25:59 +02:00
Ted Johansson 059a8a0ff5
DEV: Generate correct i18n keys for wizard radio choices (#28370)
If you wizard step has a dash in it, e.g. foo-bar, the wrong i18n key will be inferred for selects. This PR ensures the key is underscored.
2024-08-14 14:39:18 +02:00
Osama Sayegh 1bcb5c4e21
UX: Tweak styling for the new /about page (#28367)
Various tweaks the new /about page. Main change is to make it display 3 columns of users instead of 2 when there's enough space.
2024-08-14 14:57:35 +03:00
锦心 1ffb0462c1
FIX: FormKit: Allow 0 in required number input (#28368)
0 is falsy in JavaScript, so the original code would treat 0 as if it
were not input. This unique exception was added to prevent 0 from being
treated as empty input.
2024-08-14 19:46:24 +08:00
Osama Sayegh 3704a917a9
FIX: Don't show blank space when there's no banner image (#28366)
This commit fixes a bug in the redesigned about page where if there's no banner image configured for the page, the top of the page where the banner goes is occupied with large white space. Additionally, this commit also fixes a related bug in the admin config area for the /about page where it's not possible to remove the uploaded banner image.
2024-08-14 10:34:34 +03:00
Krzysztof Kotlarek e82e255531
FIX: serialize Flags instead of PostActionType (#28362)
### Why?
Before, all flags were static. Therefore, they were stored in class variables and serialized by SiteSerializer. Recently, we added an option for admins to add their own flags or disable existing flags. Therefore, the class variable had to be dropped because it was unsafe for a multisite environment. However, it started causing performance problems. 

### Solution
When a new Flag system is used, instead of using PostActionType, we can serialize Flags and use fragment cache for performance reasons. 

At the same time, we are still supporting deprecated `replace_flags` API call. When it is used, we fall back to the old solution and the admin cannot add custom flags. In a couple of months, we will be able to drop that API function and clean that code properly. However, because it may still be used, redis cache was introduced to improve performance.

To test backward compatibility you can add this code to any plugin
```ruby
  replace_flags do |flag_settings|
    flag_settings.add(
      4,
      :inappropriate,
      topic_type: true,
      notify_type: true,
      auto_action_type: true,
    )
    flag_settings.add(1001, :trolling, topic_type: true, notify_type: true, auto_action_type: true)
  end
```
2024-08-14 12:13:46 +10:00
dependabot[bot] ed3e566576
Build(deps): Bump terser from 5.31.5 to 5.31.6 (#28358)
Bumps [terser](https://github.com/terser/terser) from 5.31.5 to 5.31.6.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/commits)

---
updated-dependencies:
- dependency-name: terser
  dependency-type: direct:production
  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-08-14 00:57:46 +02:00
Joffrey JAFFEUX a5980ea637
FIX: access correct name and description (#28353)
`defaultCategoryLinkRenderer` is using a fake category object which doesn’t have access to the functions and getters of category model.

This had been incorrectly set in c197daa04c

As we don't get a real category object, we have to call the transformers manually and also pass the fake category object as context, this is not ideal as people might try to access properties in the transformer which are not available on the category object given they will be different based on the context. Hopefully one day this helper and all the chain can be refactored to use a real category model.

This commit also adds tests for these two properties in the category-link helper.

<!-- NOTE: All pull requests should have tests (rspec in Ruby, qunit in JavaScript). If your code does not include test coverage, please include an explanation of why it was omitted. -->
2024-08-14 00:04:55 +02:00
Ella E. 9299a9c067
FIX: Set overflow-x to auto to prevent scroll bar from always showing (#28294) 2024-08-13 13:22:36 -06:00
Jarek Radosz c96dce2934
DEV: Convert user-status-picker to glimmer/gjs/dbutton/input (#28344) 2024-08-13 18:57:57 +02:00
Jarek Radosz 82741eb0a6
DEV: Replace onClick props in topic-timeline container (#28342)
Use `on` modifier instead, and set proper href attributes on links
2024-08-13 18:38:07 +02:00
Joffrey JAFFEUX 31ae81b8eb
FIX: do not continue list inside codefence (#28346)
This commit forces the textarea to check if the list is inside a codefence and won't continue the list if it's the case.

Note this commit also uses the message param of qunit assertions to make them more explicit. It has no impact on behavior.
2024-08-13 17:36:51 +02:00
Jarek Radosz 8a09fd370a
DEV: Convert software-update-prompt to glimmer/gjs/dbutton (#28341) 2024-08-13 15:47:14 +02:00
Jarek Radosz eccfc946f1
DEV: Convert admin-watched-word to glimmer/gjs/dbutton (#28340) 2024-08-13 15:45:44 +02:00
Jarek Radosz 41593a5d7d
DEV: Convert expand-post to glimmer/gjs/dbutton (#28339) 2024-08-13 14:22:24 +02:00
Jarek Radosz 355dbb928a
Revert "DEV: Use `on` modifier (or `@action` param) (#28323)" (#28338)
This reverts commit e3e5710b3d.
2024-08-13 12:39:24 +02:00
Jarek Radosz e3e5710b3d
DEV: Use `on` modifier (or `@action` param) (#28323)
instead of `onclick` prop
2024-08-13 10:50:09 +02:00
Joffrey JAFFEUX bcfb8a5fc5
FIX: correctly render sql checkboxes (#28328)
This was not using CheckboxGroup and the I18n key was incorrect.
2024-08-13 10:46:54 +02:00
Krzysztof Kotlarek 559c9dfe0a
REVERT: FIX: serialize Flags instead of PostActionType (#28334) 2024-08-13 18:32:11 +10:00
David Battersby 0954ae70a6
FEATURE: add delay to native push notifications (#28314)
This change ensures native push notifications respect the site setting for push_notification_time_window_mins. Previously only web push notifications would account for the delay, now we can bring more consistency between Discourse in browser vs Hub, by applying the same delay strategy to both forms of push notifications.
2024-08-13 12:12:05 +04:00
Krzysztof Kotlarek d2c09e5ce1
PERF: do not expire cache when PostActionType is saved (#28337)
Reload is too expensive in a multisite environment. A proper way to expire cache is coming with the next PR.
2024-08-13 18:01:31 +10:00
Sam 1fa3eb3f2a
FIX: stop injecting uneeded margin (#28335) 2024-08-13 08:11:16 +02:00
Krzysztof Kotlarek c1f6ec3019
PERF: skip reset flag callbacks on seed (#28333)
When flags are seeded, we don't need to reset the cache for each record.

We should instead create all flags and reset the cache at the very end.
2024-08-13 13:22:57 +10:00
Krzysztof Kotlarek 094052c1ff
FIX: serialize Flags instead of PostActionType (#28259)
### Why?
Before, all flags were static. Therefore, they were stored in class variables and serialized by SiteSerializer. Recently, we added an option for admins to add their own flags or disable existing flags. Therefore, the class variable had to be dropped because it was unsafe for a multisite environment. However, it started causing performance problems. 

### Solution
When a new Flag system is used, instead of using PostActionType, we can serialize Flags and use fragment cache for performance reasons. 

At the same time, we are still supporting deprecated `replace_flags` API call. When it is used, we fall back to the old solution and the admin cannot add custom flags. In a couple of months, we will be able to drop that API function and clean that code properly. However, because it may still be used, redis cache was introduced to improve performance.

To test backward compatibility you can add this code to any plugin
```ruby
  replace_flags do |flag_settings|
    flag_settings.add(
      4,
      :inappropriate,
      topic_type: true,
      notify_type: true,
      auto_action_type: true,
    )
    flag_settings.add(1001, :trolling, topic_type: true, notify_type: true, auto_action_type: true)
  end
```
2024-08-13 11:22:37 +10:00
Régis Hanol d10fd36319
FEATURE: participating users statistics (#28322)
Adds a new statistics (hidden from the UI, but available via the API) that tracks daily participating users.

A user is considered as "participating" if they have

- Reacted to a post
- Replied to a topic
- Created a new topic
- Created a new PM
- Sent a chat message
- Reacted to a chat message

Internal ref - t/131013
2024-08-12 23:47:13 +02:00
Jan Cernik 5b78bbd138
DEV: Convert account activation pages to use Ember (#28206) 2024-08-12 18:02:00 -03:00