Commit Graph

55674 Commits

Author SHA1 Message Date
David Taylor
e8308f783d
DEV: Skip unnecessary work when booting dev server on linux (#28401)
The Listen gem watches recursively, which has a cost per-file on Linux (via rb-inotify). This commit skips a bunch of unnecessary directories to reduce the startup cost.
2024-08-16 16:05:41 +01: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
Martin Brennan
dbafa10b3c
DEV: Add backup helpers for specs (#28394)
This has been split out from https://github.com/discourse/discourse/pull/28051
so we can use this same code in plugin specs before merging the core PR,
adds some helpers for creating local backup temp files
and cleaning them up.
2024-08-16 14:51:57 +10:00
Sam
ade001604b
PERF: automatically join users to channels more efficiently (#28392)
- Only ever auto join 10k users to channels (ordered by last seen)
- Join users to all channels at once, instead of batching and splitting
2024-08-16 13:58:12 +10:00
Alan Guo Xiang Tan
de79e5628e
PERF: Reduce mem allocation of Chat::AutoRemove::HandleCategoryUpdated (#28393)
This is a follow-up to 671f40ce07 and
ed11ee9d05.

While the optimisations in the previous commits were sound, it did not
resolve the memory bloat we were seeing. It turns out that we call
`.blank?` on the model's result if the model has not been marked
optional. The problem with this is that if the model returns an
ActiveRecord relation, calling `.blank?` on the relation basically loads
everything into memory.

Therefore, this commit removes `users` as a model in the  since it really isn't
a model but just a relation.
2024-08-16 11:35:08 +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
dependabot[bot]
427f473e1b
Build(deps-dev): Bump rspec-rails from 6.1.3 to 6.1.4 (#28391)
Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 6.1.3 to 6.1.4.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v6.1.3...v6.1.4)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-16 01:17:36 +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
Alan Guo Xiang Tan
671f40ce07
PERF: Reduce memory footprint of Chat::AutoRemove::HandleCategoryUpdated.call (#28381)
This is a follow up to ed11ee9d05.

In `Chat::AutoRemove::HandleCategoryUpdated`, we are currently loading
the related users record in batches and then handing it off to
`Chat::Action::CalculateMembershipsForRemoval.call`. However, we are
still seeing memory spike as a result of this.

This commit eliminates the allocation of `User` ActiveRecord objects until
absolutely necessary. `Chat::Action::CalculateMembershipsForRemoval.call` has been
updated to accept an ActiveRecord relation instead which allows us to
avoid the ActiveRecord allocations.
2024-08-16 05:37:31 +08: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
David Battersby
e16f22c372
FIX: delay chat notify watching job (#28386)
This change delays the notify watching job to allow time for message to be marked as seen within chat.

Without a slight delay the job fires straight away and often means that messages are seen on screen but the user also receives a notification due to Chat::Notifier.user_has_seen_message? returning false.
2024-08-15 18:08:30 +04:00
dependabot[bot]
060933d064
Build(deps): Bump minitest from 5.24.1 to 5.25.0 (#28378)
Bumps [minitest](https://github.com/minitest/minitest) from 5.24.1 to 5.25.0.
- [Changelog](https://github.com/minitest/minitest/blob/master/History.rdoc)
- [Commits](https://github.com/minitest/minitest/compare/v5.24.1...v5.25.0)

---
updated-dependencies:
- dependency-name: minitest
  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-08-15 15:00:01 +02:00
dependabot[bot]
152e85e9a8
Build(deps): Bump sanitize from 6.1.2 to 6.1.3 (#28377)
Bumps [sanitize](https://github.com/rgrove/sanitize) from 6.1.2 to 6.1.3.
- [Release notes](https://github.com/rgrove/sanitize/releases)
- [Changelog](https://github.com/rgrove/sanitize/blob/main/HISTORY.md)
- [Commits](https://github.com/rgrove/sanitize/compare/v6.1.2...v6.1.3)

---
updated-dependencies:
- dependency-name: sanitize
  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-15 14:59:44 +02:00
dependabot[bot]
016cb56603
Build(deps-dev): Bump puppeteer-core from 23.0.2 to 23.1.0 (#28380)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 23.0.2 to 23.1.0.
- [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.0.2...puppeteer-core-v23.1.0)

---
updated-dependencies:
- dependency-name: puppeteer-core
  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-15 14:59:31 +02: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
Gabriel Grubba
fc33826dc5
DEV: Removal of create_post_for_category_and_tag_changes setting (#28321)
* DEV: Removal of create_post_for_category_and_tag_changes setting

reverting commit: #65f35e1
and adding a migration to remove the setting
ref: t/132320

* DEV: change checks for zeros to check for nils

* DEV: remove create_post_for_category_and_tag_changes migration file

If anything goes wrong, we can always revert back to the previous state.
2024-08-14 12:12:21 -03: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
Gabriel Grubba
f6fadd7129
FEATURE: bring plugin:create to core from create-discourse-plugin gem (#28350)
* FEATURE: bring plugin:create to core from `gem exec create-discourse-plugin`

* DEV: remove plugin_rake spec and updated plugin rake creation with `begin/rescue` block
2024-08-14 11:45:46 -03: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
dependabot[bot]
2fa378d693
Build(deps): Bump rails_multisite from 6.0.0 to 6.1.0 (#28356)
Bumps [rails_multisite]() from 6.0.0 to 6.1.0.

---
updated-dependencies:
- dependency-name: rails_multisite
  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-14 13:05:32 +02: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
Discourse Translator Bot
5c5cf491b2
Update translations (#28364) 2024-08-14 08:10:44 +02:00
Alan Guo Xiang Tan
8591c7c964
DEV: Update mini_racer (#28363)
This pulls in 87ef545a27
2024-08-14 13:08:24 +08:00
Alan Guo Xiang Tan
10ff0ee0cc
FIX: Ensure we dispose of MiniRacer::Context before forking daemons (#28361)
This commit updates `Demon::Base#start` to call `Discourse.before_fork`
before forking. According to the docs in `mini_racer`, we need to
"Dispose manually of all MiniRacer::Context objects prior to forking".

This commit is motivated by a segmentation fault which we are seeing in
production when killing a daemon process. Backtrace of the core dump
includes traces of `mini_racer` so we think this is the cause. Note that
we are not 100% sure if this will fix the issue.
2024-08-14 12:45:34 +08: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
Alan Guo Xiang Tan
ed11ee9d05
PERF: Reduce memory footprint of Chat::AutoRemove::HandleCategoryUpdated (#28332)
This commit seeks to reduce the memory footprint of `Chat::AutoRemove::HandleCategoryUpdated.call`
by optimizing the
`Chat::AutoRemove::HandleCategoryUpdated#remove_users_without_channel_permission` method which was
loading all the ActiveRecord users objects into memory at once. This
change updates the method call to load the ActiveRecord user objects in
batches instead.
2024-08-14 09:30:36 +08:00
dependabot[bot]
106406b8a4
Build(deps): Bump axios from 1.6.8 to 1.7.4 (#28359)
Bumps [axios](https://github.com/axios/axios) from 1.6.8 to 1.7.4.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.6.8...v1.7.4)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-14 01:25:08 +02:00
dependabot[bot]
9acca5e3f5
Build(deps-dev): Bump sqlite3 from 2.0.3 to 2.0.4 (#28354)
Bumps [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/sparklemotion/sqlite3-ruby/releases)
- [Changelog](https://github.com/sparklemotion/sqlite3-ruby/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/sqlite3-ruby/compare/v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: sqlite3
  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-14 01:06:33 +02:00
dependabot[bot]
f46fac99a7
Build(deps-dev): Bump rswag-specs from 2.13.0 to 2.14.0 (#28355)
Bumps [rswag-specs](https://github.com/rswag/rswag) from 2.13.0 to 2.14.0.
- [Release notes](https://github.com/rswag/rswag/releases)
- [Changelog](https://github.com/rswag/rswag/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rswag/rswag/compare/2.13.0...2.14.0)

---
updated-dependencies:
- dependency-name: rswag-specs
  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-14 01:05:29 +02:00
dependabot[bot]
a893377d4e
Build(deps-dev): Bump shoulda-matchers from 6.3.0 to 6.3.1 (#28357)
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/thoughtbot/shoulda-matchers/releases)
- [Changelog](https://github.com/thoughtbot/shoulda-matchers/blob/main/CHANGELOG.md)
- [Commits](https://github.com/thoughtbot/shoulda-matchers/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: shoulda-matchers
  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-14 00:58:11 +02: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
Loïc Guitaut
1e3caeafa0 DEV: Add spec to ensure app works with multiple tagged loggers
When upgrading to Rails 7.1, we had some problems because we were using
several tagged loggers at the same time. They were all added to the main
broadcast logger shipped with Rails, but the Rails 7.1 codebase contains
a bug making a request being run as many times as there are tagged loggers.

The fix was to use the code from the Rails 7.2 codebase.

This patch adds a small spec to ensure the behavior will stay the proper
one in the future.
2024-08-13 18:10:03 +02:00