Commit Graph

55386 Commits

Author SHA1 Message Date
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
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
chapoi
b3bf465890
UX: remove baseline alignment from chat timestamp (#28345) 2024-08-13 17:07:12 +02:00
Discourse Translator Bot
05e120a9f2
Update translations (#28246) 2024-08-13 16:31:24 +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
dependabot[bot]
9641835743
Build(deps): Bump rexml from 3.3.4 to 3.3.5 (#28325)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.4 to 3.3.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.3.4...v3.3.5)

---
updated-dependencies:
- dependency-name: rexml
  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-08-13 11:02:26 +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
dependabot[bot]
5f9ec742b9
Build(deps): Bump cose from 1.3.0 to 1.3.1 (#28326)
Bumps [cose](https://github.com/cedarcode/cose-ruby) from 1.3.0 to 1.3.1.
- [Changelog](https://github.com/cedarcode/cose-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/cedarcode/cose-ruby/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: cose
  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-13 10:49:55 +02:00
dependabot[bot]
1e1fef68af
Build(deps-dev): Bump test-prof from 1.3.3.1 to 1.4.0 (#28327)
Bumps [test-prof](https://github.com/test-prof/test-prof) from 1.3.3.1 to 1.4.0.
- [Release notes](https://github.com/test-prof/test-prof/releases)
- [Changelog](https://github.com/test-prof/test-prof/blob/master/CHANGELOG.md)
- [Commits](https://github.com/test-prof/test-prof/compare/v1.3.3.1...v1.4.0)

---
updated-dependencies:
- dependency-name: test-prof
  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-13 10:48:05 +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
Robert
47f749744f
FIX: poll when config is on_close only show results when poll is closed (#28299)
See: https://meta.discourse.org/t/cant-edit-topic-with-poll-bug-occurs/320845?u=merefield

When the Poll is set to "results ON_CLOSE", vote numbers for each option are only streamed to the browser when the vote is Closed. It is therefore not possible to render the Results.

The current issue is that when you refresh the page, for those that have voted the default view is results. For this type of poll this should NOT happen. The Results view in this mode should not be possible to see until closure, even for the Author.

Because the votes are not yet serialised when this kind of poll remains open, an attempt to display results causes a JavaScript exception and in any case does not make logical sense.

So the fix here is making sure the default view, for Polls that have results on close, is the voting view until the Poll is Closed.

I've added a test to cover this scenario.

Additionally, this requires a refresh of the page when the poll admin actions a Close to ensure the results are serialized in.
2024-08-13 09:29:16 +02:00
Robert
60d62f1b7e
FIX: poll ranked choice voter list corrupting on expand (#28315)
Initially, the poll results display a maximum of 25 voters per option. If the number of voters exceeds this limit, a button allows users to load additional pages of voters.

When this button is clicked, a method is called to retrieve the additional voter information. However, there was a bug where the local tracked object was not properly updated for ranked choice voters. This is due to the existence of two attributes per option: one indicating whether new data is currently loading, and the other containing the list of voters.

Instead of updating the entire option key with the voters list, the fix requires updating the voters attribute only.

This is a small but critical change. The pull request also includes a new test that significantly increases coverage, addressing this issue and beyond.
2024-08-13 09:28:28 +02:00
Krzysztof Kotlarek
a6748a7c37
PERF: no redis calls when running migrations (#28336)
Avoid reaching Redis cache while running migrations
2024-08-13 14:20:31 +08: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
09262ac9b9
FIX: not hit Redis cache in seeds (#28329)
Hardcode IDs because seed in multisite environment is run concurrently which can cause performance problems.
2024-08-13 12:42:54 +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
dependabot[bot]
c4c3520ff5
Build(deps-dev): Bump parallel from 1.26.1 to 1.26.2 (#28308)
Bumps [parallel](https://github.com/grosser/parallel) from 1.26.1 to 1.26.2.
- [Commits](https://github.com/grosser/parallel/compare/v1.26.1...v1.26.2)

---
updated-dependencies:
- dependency-name: parallel
  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-08-12 23:53:09 +02: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
Kris
df18bcd029
A11Y: remove redundant tabindex=0 from polls (#28320) 2024-08-12 14:42:06 -04:00
Kris
c0611a06e5
UX: remove poll button bg color to avoid highlight issue (#28319) 2024-08-12 14:39:37 -04:00
Jan Cernik
043fc0a117
UX: Small topic map improvements and fixes (#28215) 2024-08-12 15:37:05 -03:00
Gabriel Grubba
157c8e660a
FEATURE: Change tags sent in topic_tags_changed trigger in automation plugin (#28318)
* FEATURE: Change tags sent in topic_tags_changed trigger in discourse_automation

Before, it was sending the old tags and the current tags in topic.
Now, it sends the removed tags and the added tags in the topic.

* DEV: update `missing_tags` to be `removed_tags`

* DEV: add spacing for better readability
2024-08-12 14:05:16 -03:00
Mark VanLandingham
79f871b558
FIX: Display new DM button when public channels are disabled (#28306) 2024-08-12 08:44:51 -05:00
Osama Sayegh
1d6e54e54c
DEV: Add admins and moderators sections to the redesigned /about page (#28273)
This commit continues on work laid out by 6039b513fe to redesign the /about page. In this commit, we add sections for showing the site admins and moderators.

The lists of admins and moderators display the 10 most recently seen admins/moderators, with a button to display the rest of admins or moderators. Admins or moderators that have not logged in to the site in the last year will not be shown. Clicking on an admin's or moderator's name/avatar will show their user card.
2024-08-12 16:23:44 +03:00
Jarek Radosz
34de336afb
DEV: Remove an unused component (#28316)
(admin/resumable-upload)
2024-08-12 14:45:40 +02:00
Jarek Radosz
2a193f2173
DEV: Fix unsafe binding warnings (#28317)
e.g.

```
WARNING: Binding style attributes may introduce cross-site scripting vulnerabilities; please ensure that values being bound are properly escaped. For more information, including how to disable this warning, see https://deprecations.emberjs.com/v1.x/#toc_binding-style-attributes. Style affected: \"height: 60px\"
```
2024-08-12 14:06:22 +02:00
dependabot[bot]
d217a1756d
Build(deps): Bump oj from 3.16.4 to 3.16.5 (#28287)
* Build(deps): Bump oj from 3.16.4 to 3.16.5

Bumps [oj](https://github.com/ohler55/oj) from 3.16.4 to 3.16.5.
- [Release notes](https://github.com/ohler55/oj/releases)
- [Changelog](https://github.com/ohler55/oj/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/ohler55/oj/compare/v3.16.4...v3.16.5)

---
updated-dependencies:
- dependency-name: oj
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

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

* add ostruct to default gems list

---------

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-12 12:16:54 +02:00
dependabot[bot]
c42a5a4700
Build(deps-dev): Bump puppeteer-core from 23.0.1 to 23.0.2 (#28291)
Bumps [puppeteer-core](https://github.com/puppeteer/puppeteer) from 23.0.1 to 23.0.2.
- [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.1...puppeteer-core-v23.0.2)

---
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-08-12 10:57:30 +02:00
Loïc Guitaut
84823550d4 DEV: Enable Rails 7.1 defaults 2024-08-12 10:41:13 +02:00
dependabot[bot]
52a14e0669
Build(deps-dev): Bump shoulda-matchers from 6.2.0 to 6.3.0 (#28311)
Bumps [shoulda-matchers](https://github.com/thoughtbot/shoulda-matchers) from 6.2.0 to 6.3.0.
- [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.2.0...v6.3.0)

---
updated-dependencies:
- dependency-name: shoulda-matchers
  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-12 09:22:53 +08:00
dependabot[bot]
529a0450a5
Build(deps-dev): Bump selenium-devtools from 0.126.0 to 0.127.0 (#28309)
Bumps [selenium-devtools](https://github.com/SeleniumHQ/selenium) from 0.126.0 to 0.127.0.
- [Release notes](https://github.com/SeleniumHQ/selenium/releases)
- [Changelog](https://github.com/SeleniumHQ/selenium/blob/trunk/rb/CHANGES)
- [Commits](https://github.com/SeleniumHQ/selenium/commits)

---
updated-dependencies:
- dependency-name: selenium-devtools
  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-12 09:22:42 +08:00