Commit Graph

57108 Commits

Author SHA1 Message Date
Loïc Guitaut
9e9abe0a82 DEV: Unify params access in services
Currently, there are two ways (kind of) for accessing `params` inside a
service:
- when there is no contract or it hasn’t been reached yet, `params` is
  just the hash that was provided to the service. To access a key, you
  have to use the bracket notation `params[:my_key]`.
- when there is a contract and it has been executed successfully,
  `params` now references the contract and the attributes are accessible
  using methods (`params.my_key`).

This patch unifies how `params` exposes its attributes. Now, even if
there is no contract at all in a service, `params` will expose its
attributes through methods, that way things are more consistent.

This patch also makes sure there is always a `params` object available
even when no `params` key is provided to the service (this allows a
contract to fail because its attributes are blank instead of having the
service raising an error because it doesn’t find `params` in its context).
2024-12-13 11:13:18 +01:00
Joffrey JAFFEUX
cbc0ece6e8
DEV: <DSelect /> (#30224)
`<DSelect />` is a wrapper similar to our existing `<DButton />` over the html element `<select>`. The code is ported from form kit which is now directly using `<DSelect />`. Note this component has also been used in edit topic timer modal.

This component is recommended for a small list of text items (no icons, no rich formatting...).

Usage:

```gjs
<DSelect class="my-select" @onChange={{this.handleChange}} as |select|>
  <select.Option @value="foo" class="my-favorite-option">Foo</select.Option>
  <select.Option @value="bar">Bar</select.Option>
</DSelect>
```

This commit comes with a set of assertions:

```gjs
import dselect from "discourse/tests/helpers/d-select-helper";
import { select } from "@ember/test-helpers";

assert
  .dselect(".my-select")
  .hasOption({ value: "bar", label: "Bar" })
  .hasOption({ value: "foo", label: "Foo" })
  .hasNoOption("baz");

await select(".my-select", "foo");

assert.dselect(".my-select").hasSelectedOption({value: "foo", label: "Foo"});
```
2024-12-13 10:40:06 +01:00
Natalie Tay
622eb9e51c
FIX: Avoid zipping when adding users to groups (#30263) 2024-12-13 17:24:40 +08:00
Alan Guo Xiang Tan
ebfc33b556
DEV: Remove line of code that does not work (#30258)
We can't delete the file from disk as some of the assets are still
served by the app instead of going through the S3 bucket. It is a bug we
need to fix but it also means this ENV is unsafe now. Just drop the env
until we ensure all assets requested by the app are requested from the
S3 bucket directly.
2024-12-13 09:36:51 +08:00
Jarek Radosz
ae6fca2f0b
DEV: Add io-console to default gems list (#30257) 2024-12-13 02:35:05 +01:00
Martin Brennan
fae6ffcf06
UX: Introduce <DStatTiles /> component (#30238)
Introduces a new component used to show a grid of stats
on any page, mostly used for dashboards and config pages.
This component yields a hash with a `Tile` component property,
and the caller can loop through their stats and display them
using this component.

Each stat needs a @label and a @value at minimum, but can
also pass in a @tooltip and a @url.
2024-12-13 11:32:46 +10:00
dependabot[bot]
54f0dd40ad
Build(deps): Bump css_parser from 1.19.1 to 1.20.0 (#30251)
Bumps [css_parser](https://github.com/premailer/css_parser) from 1.19.1 to 1.20.0.
- [Changelog](https://github.com/premailer/css_parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/premailer/css_parser/compare/v1.19.1...v1.20.0)

---
updated-dependencies:
- dependency-name: css_parser
  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-12-13 02:06:14 +01:00
dependabot[bot]
635cfdced7
Build(deps): Bump rails-html-sanitizer from 1.6.1 to 1.6.2 (#30250)
Bumps [rails-html-sanitizer](https://github.com/rails/rails-html-sanitizer) from 1.6.1 to 1.6.2.
- [Release notes](https://github.com/rails/rails-html-sanitizer/releases)
- [Changelog](https://github.com/rails/rails-html-sanitizer/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rails/rails-html-sanitizer/compare/v1.6.1...v1.6.2)

---
updated-dependencies:
- dependency-name: rails-html-sanitizer
  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-12-13 02:03:56 +01:00
dependabot[bot]
d039ed4241
Build(deps-dev): Bump rubocop-rspec from 3.2.0 to 3.3.0 (#30252)
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  dependency-type: indirect
  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-12-13 02:03:28 +01:00
dependabot[bot]
2960b6938b
Build(deps-dev): Bump rubocop from 1.69.1 to 1.69.2 (#30249)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.69.1 to 1.69.2.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.69.1...v1.69.2)

---
updated-dependencies:
- dependency-name: rubocop
  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-12-13 02:03:20 +01:00
dependabot[bot]
399d008936
Build(deps-dev): Bump lefthook from 1.9.0 to 1.9.2 (#30254)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.9.0 to 1.9.2.
- [Release notes](https://github.com/evilmartians/lefthook/releases)
- [Changelog](https://github.com/evilmartians/lefthook/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evilmartians/lefthook/compare/v1.9.0...v1.9.2)

---
updated-dependencies:
- dependency-name: lefthook
  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-12-13 02:02:34 +01:00
dependabot[bot]
f11b56336e
Build(deps-dev): Bump puppeteer-core from 23.10.3 to 23.10.4 (#30253)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 23.10.3 to 23.10.4.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json)
- [Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v23.10.3...puppeteer-core-v23.10.4)

---
updated-dependencies:
- dependency-name: puppeteer-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-12-13 02:02:04 +01:00
Amanda Alves Branquinho
462e613c08
FIX: pass correct arg to outlet (#30159)
* Fix:pass correct arg to outlet

* Update app/assets/javascripts/discourse/app/components/small-user-list.gjs

Co-authored-by: Jarek Radosz <jradosz@gmail.com>

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2024-12-12 21:49:22 -03:00
Sérgio Saquetim
c9247cde29
DEV: Only print console message about the Glimmer post menu once (#30255) 2024-12-12 20:40:52 -03:00
Jan Cernik
96417592a3
FIX: Show validation error on confirmation user fields (#30232)
* FIX: Show validation error on confirmation user fields

* test
2024-12-12 18:45:28 -03:00
Sérgio Saquetim
c3e7d97048
DEV: Switch the glimmer post menu to auto and unsilence deprecations (#30161)
This commit starts the rollout of the Glimmer post menu:

- default to `auto`: after the upgrade, it will be enabled on all discourse instances that do not have incompatible customizations

- unsilence the deprecation messages in the console

- removes the setting `glimmer_post_menu_groups` as it's no longer in the test phase
2024-12-12 18:27:02 -03:00
Sérgio Saquetim
6fa52a6499
DEV: Improve tests and fixes small issues in the Glimmer Post Menu (#30234)
This commit improves some tests to using both the glimmer post menu and the widget version.

It also addresses some small issues in the Glimmer Post Menu:

- Deprecated Font Awesome icon in the Edit button
- Set correctly `aria-pressed` in the Like Count when the list of people who liked is visible
- Display the user tip for the Show More button
2024-12-12 15:36:05 -03:00
Mark VanLandingham
bbb31b05ca
DEV: add full_move to MovedPost record small_action modifier (#30236)
This commit adds a new column full_move to the moved_posts table. This is useful to look back at history and determine if a whole topic was moved or partial.

This commit also adds an apply_modifier to skip the creation of the moved posts small action.
2024-12-12 11:47:14 -06:00
Régis Hanol
1791abab25
FIX: replace dropdown with button when there's only one option (#30242)
On mobile, in the topic footer buttons, instead of showing all the
buttons, we "merge" some of then into a dropdown.

If the dropdown has only one "option", then it doesn't make sense to
show the "ellipsis" button. Instead, we directly show the button of the
only available option. Saving a click on the way.
2024-12-12 17:56:30 +01:00
Kris
9694dc6cb0
DEV: prioritize new email styles over existing, to make customization easier (#30244) 2024-12-12 11:42:50 -05:00
Arpit Jalan
357189d9e7
DEV: add plugin outlets to accommodate customizations (#30222)
* DEV: add plugin outlets to accommodate customizations

* add the same outlet in glimmer file
2024-12-12 21:27:45 +05:30
Régis Hanol
b74007db0a
FIX: restore zero-width space character... (#30243)
... that got **wrongly** (my bad) removed in 6ef0b5d508
2024-12-12 16:10:01 +01:00
chapoi
ee567165f1
UX: increase button sizes and timeline size (#30240)
* UX: increase button sizes and timeline size

* UX: bring back tracking btn on topic timeline desktop

* Scope flexing topic-navigation area to mobile + make all buttons same font-size
2024-12-12 16:09:44 +01:00
Loïc Guitaut
a589b48f9a DEV: Display better output when inspecting service steps
This patch aims to improve the steps inspector output:
- The service class name is displayed at the top.
- Next to each step is displayed the time it took to run said step.
- Steps that didn’t run are hidden.
- `#inspect` automatically outputs the error when it is present.
2024-12-12 15:21:10 +01:00
dependabot[bot]
3ca7c5e438
Build(deps-dev): Bump @swc/core from 1.10.0 to 1.10.1 (#30187)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.10.0 to 1.10.1.
- [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.10.0...v1.10.1)

---
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-12-12 14:06:57 +01:00
Gerhard Schlager
c357e621ef
FIX: Link to group didn't work in locales other than English (#30237)
Group names are translated, so the slug changes depending on the default locale. This could break the link to the staff group.
2024-12-12 13:26:51 +01:00
dependabot[bot]
35ee746a14
Build(deps-dev): Bump puppeteer-core from 23.10.1 to 23.10.3 (#30212)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 23.10.1 to 23.10.3.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json)
- [Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-core-v23.10.1...puppeteer-core-v23.10.3)

---
updated-dependencies:
- dependency-name: puppeteer-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-12-12 13:23:33 +01:00
Régis Hanol
44cabc3569
FIX: proper details / summary excerpt (#30229)
It doesn't make much sense to have the content of a `<details>` in an excerpt so I replaced them with "▶ summary" instead.

That way, they can't be (ab)used in user cards for example.

Reference - https://meta.discourse.org/t/335094
2024-12-12 09:09:49 +01:00
moin-Jana
7c00c52c36
UX: Rename private to personal messages in the interface (#29679)
Rename "private messages" to "personal messages" in the interface
2024-12-12 11:44:19 +11:00
Bianca Nenciu
a835fd99bd FIX: Truncate bookmarks.name when remapping
The new name may be too long for the bookmarks.name column and raise an
exception. This changes allows the remapper to truncate the new value to
fit (truncates to 100 characters).
2024-12-11 18:53:17 -05:00
Krzysztof Kotlarek
8bd55c35fb
UX: Hide admin header for edit/new webhook (#30194)
In this PR, we added functionality to hide the admin header for edit/new actions - https://github.com/discourse/discourse/pull/30175

To make it work properly, we have to rename `show` to `edit` which is also a more accurate name.
2024-12-12 10:49:17 +11:00
Martin Brennan
203f93bcaf
FIX: Background color for settings overriden filter (#30221)
This was fixed previously but must have regressed, we
are showing a darker grey background around the
"Only show overridden" checkbox for our Settings tab
in config pages.
2024-12-12 10:27:37 +11:00
Keegan George
9df7d6f9a0
UX: Make radio buttons respect forum's accent color (#30235)
Similar to 601780aadf, this change ensures radio buttons respect the forum's accent color. Visual color change only, as such no tests.
2024-12-11 15:22:00 -08:00
Kris
9f68b037d4
UX: fix PM title editing layout (#30233) 2024-12-12 09:18:52 +11:00
Keegan George
601780aadf
UX: Make checkboxes respect forum's accent color (#30231)
This change ensures checkboxes respect the forum's accent color. Visual color change only, as such no tests.
2024-12-11 12:55:22 -08:00
Keegan George
c9119099a9
FIX: Regression allowing async calls to finish before removing uploads (#30230)
This PR fixes a recent regression in e37952c9db that reverted a fix made in 1c4d5dae1c, which allowed for async calls to finish first before removing in progress uploads.
2024-12-11 10:35:46 -08:00
Kris
02eca6e489
UX: add header-categories-wrapper outlet (#30214) 2024-12-11 11:17:43 -05:00
Kris
aabf174ac8
UX: fix admin sidebar header width (#30226) 2024-12-11 11:09:27 -05:00
Sérgio Saquetim
1505978586
DEV: Upgrade dependencies to Ember 5.12 (#30131) 2024-12-11 11:09:25 -03:00
Régis Hanol
6ef0b5d508
Cleanup mobile topic footer area (#30132) 2024-12-11 14:59:37 +01:00
Gary Pendergast
28a1463baf
FIX: When moving first posts between topics, ensure only relevant timings are moved (#30217) 2024-12-11 17:03:47 +11:00
Alan Guo Xiang Tan
c97d1d7c59
DEV: Remove max compression level for brotli in assets.rake (#30220)
The `max_compress?` logic is totally broken at least when used for
brotli compression because we are only seeing 4 assets subjected to the
max compression level in production. Instead of fixing the broken logic,
we should just drop this unnecessary complexity cause things are easier
to reason about when we only have one compression level to deal with
across all assets.
2024-12-11 14:01:33 +08:00
Alan Guo Xiang Tan
19321a0b86
DEV: Fix s3:upload_assets not logging newlines (#30219)
Follow-up to 9a2e31b9af
2024-12-11 12:59:17 +08:00
Alan Guo Xiang Tan
9a2e31b9af
DEV: Use a Logger for s3:upload_assets (#30218)
Now that we run the `upload` method in different threads, we need to
synchronize writes to `STDOUT` which we can do so by using a `Logger`.

Follow-up to 49e8353959
2024-12-11 11:48:06 +08:00
Alan Guo Xiang Tan
49e8353959
FIX: s3:upload_assets was uploaded some source maps twice (#30216)
This is because Sprocket's manifest already contains the source maps.
The easy and safe fix here is to just use a `Set` to prevent
duplications.
2024-12-11 11:19:38 +08:00
Bianca Nenciu
b9f8a77d9b
DEV: Upload assets to S3 in parallel (#30210)
In my local setup (with Minio), this uploads the assets to S3 ~40% faster.
2024-12-11 10:51:05 +08:00
Alan Guo Xiang Tan
864b7b6bc8
DEV: Fix flaky test (#30215)
The test was flaky and failing with the following errors:

```
Failure/Error:
  klass
    .connection
    .select_raw(relation.arel) do |result, _|
      result.type_map = DB.type_map
      result.nfields == 1 ? result.column_values(0) : result.values
    end

NoMethodError:
  undefined method `select_raw' for nil

./lib/freedom_patches/fast_pluck.rb:60:in `pluck'
./vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/relation/calculations.rb:354:in `pick'
./app/models/web_crawler_request.rb:27:in `request_id'
./app/models/web_crawler_request.rb:31:in `rescue in request_id'
./app/models/web_crawler_request.rb:26:in `request_id'
./app/models/web_crawler_request.rb:19:in `write_cache!'
./app/models/concerns/cached_counting.rb:135:in `block (3 levels) in flush_to_db'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
./app/models/concerns/cached_counting.rb:134:in `block (2 levels) in flush_to_db'
./app/models/concerns/cached_counting.rb:124:in `each'
./app/models/concerns/cached_counting.rb:124:in `block in flush_to_db'
./lib/distributed_mutex.rb:53:in `block in synchronize'
./lib/distributed_mutex.rb:49:in `synchronize'
./lib/distributed_mutex.rb:49:in `synchronize'
./lib/distributed_mutex.rb:34:in `synchronize'
./app/models/concerns/cached_counting.rb:120:in `flush_to_db'
./app/models/concerns/cached_counting.rb:187:in `perform_increment!'
./app/models/web_crawler_request.rb:15:in `increment!'
./lib/middleware/request_tracker.rb:74:in `log_request'
./lib/middleware/request_tracker.rb:409:in `block in log_later'
./lib/scheduler/defer.rb:125:in `block in do_work'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management/null_instance.rb:49:in `with_connection'
./vendor/bundle/ruby/3.3.0/gems/rails_multisite-6.1.0/lib/rails_multisite/connection_management.rb:21:in `with_connection'
./lib/scheduler/defer.rb:119:in `do_work'
./lib/scheduler/defer.rb:105:in `block (2 levels) in start_thread'
```

This was due to running the defer thread in an async manner which is
actually no representative of the production environment. It also
revealed a spot in our code base where writes are happening in a GET
request which can cause requests to fail if ActiveRecord is in readonly
mode.
2024-12-11 10:12:58 +08:00
dependabot[bot]
8524430b44
Build(deps): Bump actionpack from 7.2.2 to 7.2.2.1 (#30213)
Bumps [actionpack](https://github.com/rails/rails) from 7.2.2 to 7.2.2.1.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v8.0.0.1/actionpack/CHANGELOG.md)
- [Commits](https://github.com/rails/rails/compare/v7.2.2...v7.2.2.1)

---
updated-dependencies:
- dependency-name: actionpack
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-11 08:10:17 +08:00
Discourse Translator Bot
c65192a7a2
Update translations (#30202) 2024-12-10 20:16:34 +01:00
David Taylor
e2dcb71c11
DEV: Fixup verbose localization method name (#30208)
Followup to e5a2ed596c
2024-12-10 17:30:36 +00:00