Commit Graph

55613 Commits

Author SHA1 Message Date
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
dependabot[bot] 4572c08d79
Build(deps): Bump concurrent-ruby from 1.3.3 to 1.3.4 (#28310)
Bumps [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/ruby-concurrency/concurrent-ruby/releases)
- [Changelog](https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ruby-concurrency/concurrent-ruby/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: concurrent-ruby
  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 09:21:54 +08:00
dependabot[bot] d9bce3087d
Build(deps-dev): Bump @swc/core from 1.7.6 to 1.7.10 (#28312)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.7.6 to 1.7.10.
- [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.6...v1.7.10)

---
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-12 09:21:42 +08:00
dependabot[bot] 516795b81b
Build(deps-dev): Bump lefthook from 1.7.11 to 1.7.12 (#28313)
Bumps [lefthook](https://github.com/evilmartians/lefthook) from 1.7.11 to 1.7.12.
- [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.7.11...v1.7.12)

---
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-08-12 09:21:29 +08:00
Kris c002911bed
UX: set "topics" link in sidebar as active for hot, unseen, and my posts filters (#28305) 2024-08-09 16:39:12 -04:00
Kris 9d5eb6fed6
A11Y: add aria-label to avatar link on categories page (#28304) 2024-08-09 14:13:45 -04:00
David Taylor b59b24884f
DEV: Promote modifyClass warning to error (#28300)
This message indicates broken behavior, so it should be an error rather than a warning.

An early-return is added, so that we don't even attempt to make the modification. This will make the behavior consistent, and easier to understand.

Also updates the normalization logic to use the resolver's own logic. This will handle all sorts of normalization in addition to our deprecations.
2024-08-09 16:45:33 +01:00
Mark VanLandingham 206bbb4255
UX: Add sidebar DM list back when public channels are disabled (#28301) 2024-08-09 09:16:14 -05:00
David Taylor df5561d780
DEV: Ensure deprecation warning banner works in development builds (#28302)
In development, Ember raises an error when previously-used values are updated during a render. This is to avoid 'backtracking', where parts of templates have to be re-rendered multiple times. In general, this kind of pattern should be avoided, and Ember's warning helps us do that.

However, for the deprecation warning banner, it is quite reasonable for some rendering to trigger a deprecation, and thereby require the global-notice to be re-rendered. We can use our `DeferredTrackedSet` to achieve that. Its `.add` method will delay adding an item to the Set until after the current render has completed.
2024-08-09 15:04:05 +01:00
Kris 234e155d3c
A11Y: do not skip heading levels in keyboard shortcut modal (#28285) 2024-08-09 09:29:53 -04:00
David Taylor 65895f44e9
DEV: print modifyClass warning correctly for deprecated lookups (#28298)
e.g. we map `controller:composer` to `service:composer` in resolver lookups. So, when doing the cache check in modifyClass, we need to check against the normalized name, not the deprecated name.
2024-08-09 09:20:14 +01:00
dependabot[bot] 6d1862409e
Build(deps-dev): Bump parser from 3.3.4.1 to 3.3.4.2 (#28286)
Bumps [parser](https://github.com/whitequark/parser) from 3.3.4.1 to 3.3.4.2.
- [Changelog](https://github.com/whitequark/parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/whitequark/parser/compare/v3.3.4.1...v3.3.4.2)

---
updated-dependencies:
- dependency-name: parser
  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-09 11:52:16 +08:00
dependabot[bot] c0b6a975d8
Build(deps-dev): Bump parallel from 1.25.1 to 1.26.1 (#28288)
Bumps [parallel](https://github.com/grosser/parallel) from 1.25.1 to 1.26.1.
- [Commits](https://github.com/grosser/parallel/compare/v1.25.1...v1.26.1)

---
updated-dependencies:
- dependency-name: parallel
  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-09 11:51:16 +08:00
dependabot[bot] 6229dc3bfd
Build(deps): Bump terser from 5.31.4 to 5.31.5 (#28289)
Bumps [terser](https://github.com/terser/terser) from 5.31.4 to 5.31.5.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.31.4...v5.31.5)

---
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-09 11:51:03 +08:00
Krzysztof Kotlarek 56524f4bdf
DEV: flaky toggle flag spec (#28292)
Very similar to move up/down flag problem fixed here -  https://github.com/discourse/discourse/pull/28272

Those are the steps to toggle the flag:
1. click toggle - `saving` CSS class is added;
2. request to backend;
3. `saving` CSS class is removed.

And check if the flag was toggle was:
```ruby
def has_saved_flag?(key)
  has_css?(".admin-flag-item.#{key}.saving")
  has_no_css?(".admin-flag-item.#{key}.saving")
end
```
If the save action is very fast, then the saving class is removed before the first check.

Therefore I decided to invert it, and once action is finished add `saved` CSS class.

Then we can have a quick positive check:

```ruby
def has_saved_flag?(key)
  has_css?(".admin-flag-item.#{key}.saved")
end
```
2024-08-09 09:56:10 +10:00
dependabot[bot] 6cf613d5f5
Build(deps-dev): Bump @floating-ui/dom from 1.6.9 to 1.6.10 (#28270)
Bumps [@floating-ui/dom](https://github.com/floating-ui/floating-ui/tree/HEAD/packages/dom) from 1.6.9 to 1.6.10.
- [Release notes](https://github.com/floating-ui/floating-ui/releases)
- [Changelog](https://github.com/floating-ui/floating-ui/blob/master/packages/dom/CHANGELOG.md)
- [Commits](https://github.com/floating-ui/floating-ui/commits/@floating-ui/dom@1.6.10/packages/dom)

---
updated-dependencies:
- dependency-name: "@floating-ui/dom"
  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-08 23:25:47 +02:00
Joffrey JAFFEUX 7d316922e7
DEV: correctly position below-direct-chat-channels (#28283)
It should be below channels, not above.
2024-08-08 22:55:35 +02:00
Joffrey JAFFEUX f87c2e7aa7
DEV: adds chat-drawer-before-content plugin outlet (#28284)
This outlet is rendered before the content of the drawer. The `currentRouteName` is accessible in `outletArgs`.

Example:

```gjs
export default class Test extends Component {
  <template>
    {{#if (eq @outletArgs.currentRouteName "chat.browse")}}
      the browse page
    {{/if}}
  </template>
}
```
2024-08-08 22:46:55 +02:00
Isaac Janzen aeaae9babc
DEV: Add `user` modifier to prevent updating ip_address (#28280) 2024-08-08 13:06:08 -05:00
Penar Musaraj 7c5e3eacda
FEATURE: "Hot" replacing "Top" as default in the top menu (#28252)
This change only applies to instances that have not modified the
`top_menu` site setting.
2024-08-08 13:57:42 -04:00
Isaac Janzen 5b1d9d602f
DEV: Add `guardian` modifier to prevent sending PM (#28282) 2024-08-08 12:57:13 -05:00
Isaac Janzen 2527f4599d
DEV: Add `search_log` modifier to prevent search log logging (#28279) 2024-08-08 12:41:10 -05:00
David Taylor 93a10b3b2e
FIX: Site setting category titles (#28281)
These were accidentally included in the refactoring of c197daa04c
2024-08-08 18:05:35 +01:00
Jean 1c9a482eb1
UX: Add plugin outlet to embeddable hosts (#28264) 2024-08-08 12:39:46 -04:00