Commit Graph

56573 Commits

Author SHA1 Message Date
6dfe2fbe16 PERF: auto join & leave chat channels (#29193)
Chat channels that are linked to a category can be set to automatically join users.

This is handled by subscribing to the following events

- group_destroyed
- user_seen
- user_confirmed_email
- user_added_to_group
- user_removed_from_group
- category_updated
- site_setting_changed (for `chat_allowed_groups`)

As well as a

- hourly background job (`AutoJoinUsers`)
- `CreateCategoryChannel` service
- `UpdateChannel` service

There was however two issues with the current implementation

1. We were triggering a lot of background jobs, mostly because it was decided to batch to auto join/leave into groups of 1000 users, adding a lot of stress to the system
2. We had one "class" (a service or a background job) per "event" and all of them had slightly different ways to select users to join/leave, making it hard to keep everything in sync

This PR "simply" adds two new servicesL `AutoJoinChannels` and `AutoLeaveChannels` that takes care, in an efficient way, of all the cases when users might automatically join a leave a chat channel.

Every other changes come from the fact that we're now always calling either one of those services, depending on the event that happened.

In the making of these classes, a few bugs were encountered and fixed, notably

- A user is only ever able to access chat channels if and only if they're part of a group listed in the `chat_allowed_group` site setting
- A category that has no associated "category groups" is only accessible to staff members (and not "Everyone")
- A silenced user should not be able to automatically join channels
- We should not attempt to automatically join users to deleted chat channels
- There is no need to automatically join users to chat channels that have already more than `max_chat_auto_joined_users` users

Internal - t/135259 & t/70607

* DEV: add specs for auto join/leave channels services

* DEV: less hacky specs

* DEV: no instance variables in specs
2024-11-12 15:00:59 +11:00
34ed35e174 FIX: filterable staff logs for flags (#29695)
Flag actions must be added to `staff_actions` method to be filterable.
2024-11-12 11:23:18 +11:00
7f1e403a25 Revert "DEV: Enable the normalize_emails site setting by default (#29587)" (#29712)
This reverts commit 7d9d98422c8c68db5b6f64e08428ea5a2b30f4f2.
2024-11-12 10:23:02 +10:00
0a0b490743 Build(deps-dev): Bump @swc/core from 1.9.1 to 1.9.2 (#29710)
Bumps [@swc/core](https://github.com/swc-project/swc) from 1.9.1 to 1.9.2.
- [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.9.1...v1.9.2)

---
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-11-12 00:30:13 +01:00
3a80761808 Build(deps-dev): Bump rouge from 4.4.0 to 4.5.0 (#29705)
Bumps [rouge](https://github.com/rouge-ruby/rouge) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: rouge
  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-11-12 00:29:31 +01:00
f3d2011879 Build(deps): Bump securerandom from 0.3.1 to 0.3.2 (#29706)
Bumps [securerandom](https://github.com/ruby/securerandom) from 0.3.1 to 0.3.2.
- [Release notes](https://github.com/ruby/securerandom/releases)
- [Commits](https://github.com/ruby/securerandom/compare/v0.3.1...v0.3.2)

---
updated-dependencies:
- dependency-name: securerandom
  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-11-12 00:28:11 +01:00
3633485833 Build(deps): Bump msgpack from 1.7.3 to 1.7.4 (#29707)
Bumps [msgpack](https://github.com/msgpack/msgpack-ruby) from 1.7.3 to 1.7.4.
- [Changelog](https://github.com/msgpack/msgpack-ruby/blob/master/ChangeLog)
- [Commits](https://github.com/msgpack/msgpack-ruby/compare/v1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: msgpack
  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-11-12 00:26:15 +01:00
4816e8e0ec Build(deps-dev): Bump rubocop-ast from 1.34.1 to 1.35.0 (#29708)
Bumps [rubocop-ast](https://github.com/rubocop/rubocop-ast) from 1.34.1 to 1.35.0.
- [Release notes](https://github.com/rubocop/rubocop-ast/releases)
- [Changelog](https://github.com/rubocop/rubocop-ast/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-ast/compare/v1.34.1...v1.35.0)

---
updated-dependencies:
- dependency-name: rubocop-ast
  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-11-11 22:05:43 +00:00
c4f42de06c Build(deps-dev): Bump lint-to-the-future from 2.2.0 to 2.3.0 (#29709)
Bumps [lint-to-the-future](https://github.com/mansona/lint-to-the-future) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/mansona/lint-to-the-future/releases)
- [Changelog](https://github.com/mansona/lint-to-the-future/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mansona/lint-to-the-future/commits)

---
updated-dependencies:
- dependency-name: lint-to-the-future
  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-11-11 22:05:26 +00:00
3019bb577b DEV: Modernize the post menu from widgets to Glimmer components (#28670)
This commit modernizes the post menu by migrating it from the existing widget-based implementation to Glimmer components. This transition aims to improve the maintainability, performance, and overall developer experience.

It also introduces a new DAG-based transformer API for customizations that aims to be more flexible than the widget base one.

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2024-11-11 15:36:08 -03:00
5c5ac72488 Build(deps-dev): Bump jsuites from 5.7.1 to 5.7.2 (#29692)
Bumps [jsuites](https://github.com/jsuites/jsuites) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/jsuites/jsuites/releases)
- [Changelog](https://github.com/jsuites/jsuites/blob/master/changelog.md)
- [Commits](https://github.com/jsuites/jsuites/commits)

---
updated-dependencies:
- dependency-name: jsuites
  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-11-11 17:45:16 +00:00
4abf6c1e86 Build(deps-dev): Bump rspec-rails from 7.0.1 to 7.1.0 (#29688)
* Build(deps-dev): Bump rspec-rails from 7.0.1 to 7.1.0

Bumps [rspec-rails](https://github.com/rspec/rspec-rails) from 7.0.1 to 7.1.0.
- [Changelog](https://github.com/rspec/rspec-rails/blob/main/Changelog.md)
- [Commits](https://github.com/rspec/rspec-rails/compare/v7.0.1...v7.1.0)

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

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

* Apply suggestions from code review

---------

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-11-11 18:04:08 +01:00
f1700ca589 FEATURE: Paginate categories when there are many (#29569)
This commit removes the new optimized category style introduced in
previous commits (d37a0d40, 9a80d718 and 430c42ac), in favour of the
existent `categories_only`.
2024-11-11 17:32:45 +02:00
8854a7101b UX: fix link to Highlight JS demo (#29701)
Fixes: https://meta.discourse.org/t/update-or-remove-highlight-js-demo-link/304538
2024-11-11 14:48:41 +01:00
e68905510d DEV: Use the new hasHtml/includesHtml from qunit-dom (#29680) 2024-11-11 13:06:12 +01:00
95fa997e4b DEV: Upload tests workflow to use actions/upload-artifact@v4 (#29699)
v3 is going to be EOL on Nov 14.
2024-11-11 11:37:53 +00:00
011a5918f9 Build(deps-dev): Bump bullet from 7.2.0 to 8.0.0 (#29687)
Bumps [bullet](https://github.com/flyerhzm/bullet) from 7.2.0 to 8.0.0.
- [Changelog](https://github.com/flyerhzm/bullet/blob/main/CHANGELOG.md)
- [Commits](https://github.com/flyerhzm/bullet/compare/7.2.0...8.0.0)

---
updated-dependencies:
- dependency-name: bullet
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-11 12:14:58 +01:00
aba13a207f Build(deps): Bump benchmark from 0.3.0 to 0.4.0 (#29682)
Bumps [benchmark](https://github.com/ruby/benchmark) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/ruby/benchmark/releases)
- [Commits](https://github.com/ruby/benchmark/compare/v0.3.0...v0.4.0)

---
updated-dependencies:
- dependency-name: benchmark
  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-11-11 12:14:43 +01:00
88085e8523 Build(deps): Bump reline from 0.5.10 to 0.5.11 (#29686)
Bumps [reline](https://github.com/ruby/reline) from 0.5.10 to 0.5.11.
- [Release notes](https://github.com/ruby/reline/releases)
- [Commits](https://github.com/ruby/reline/compare/v0.5.10...v0.5.11)

---
updated-dependencies:
- dependency-name: reline
  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-11-11 12:11:48 +01:00
61649bd850 Build(deps): Bump uri from 1.0.0 to 1.0.1 (#29685)
Bumps [uri](https://github.com/ruby/uri) from 1.0.0 to 1.0.1.
- [Release notes](https://github.com/ruby/uri/releases)
- [Commits](https://github.com/ruby/uri/compare/v1.0.0...v1.0.1)

---
updated-dependencies:
- dependency-name: uri
  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-11-11 12:10:43 +01:00
3179ebd7c3 Build(deps): Bump ostruct from 0.6.0 to 0.6.1 (#29683)
Bumps [ostruct](https://github.com/ruby/ostruct) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/ruby/ostruct/releases)
- [Commits](https://github.com/ruby/ostruct/compare/v0.6.0...v0.6.1)

---
updated-dependencies:
- dependency-name: ostruct
  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-11-11 12:10:14 +01:00
c5e61aef48 Build(deps): Bump net-imap from 0.5.0 to 0.5.1 (#29681)
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.5.0 to 0.5.1.
- [Release notes](https://github.com/ruby/net-imap/releases)
- [Commits](https://github.com/ruby/net-imap/compare/v0.5.0...v0.5.1)

---
updated-dependencies:
- dependency-name: net-imap
  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-11-11 12:09:26 +01:00
2272b1340b DEV: Use qunit-dom instead of raw href/title comparisons (#29678) 2024-11-11 11:44:54 +01:00
429b6a4e4e DEV: Use qunit-dom instead of classList/activeElement (#29676) 2024-11-11 11:44:42 +01:00
c4de8565ec FIX: flakey due to 0 width/height images (#29700)
https://github.com/mainmatter/qunit-dom/blob/master/API.md#isvisible will return true if offsetWidth or offsetHeight are zero which could happen in this case as the test could run before the image has loaded. By forcing a minimum height in the test we ensure it will be consistent.
2024-11-11 17:23:19 +09:00
189d98f3ca DEV: Convert admin emojis UI to new layout (#29615)
This PR converts the custom emoji UI in the admin pages to follow the new admin UI guidelines.
2024-11-11 15:04:15 +08:00
4ad83a98a1 FIX: migrations must be finished to reset flags cache (#29693)
Bug introduced here: https://github.com/discourse/discourse/pull/29609

It was checking if `flags` table existed before resetting the cache. However, `require_message` flag was added in further migration:

https://github.com/discourse/discourse/blob/main/db/migrate/20240714231226_duplicate_flags_custom_type_to_require_message.rb#L5

When the admin tried to update Discourse which already has `flags` table but no `require_message` column, it was causing the error.

Therefore, we should ensure that all migrations are finished before resetting flags cache.

Meta: https://meta.discourse.org/t/update-failing-column-require-message-does-not-exist/335030
2024-11-11 12:14:14 +11:00
8c52345b55 Build(deps-dev): Bump qunit-dom from 3.2.1 to 3.3.0 (#29690) 2024-11-11 00:04:38 +01:00
78ed0bb711 DEV: Use selectors instead of query() where possible (#29677) 2024-11-10 13:53:12 +01:00
16a9663557 DEV: Use qunit-dom's isDisabled/isEnabled (#29675) 2024-11-10 02:24:58 +01:00
d67a6002eb DEV: Replace count with qunit-dom (#29674) 2024-11-10 02:06:03 +01:00
f9e58938ce DEV: Update visible/invisible uses to qunit-dom (#29672) 2024-11-10 01:41:50 +01:00
de6d575d40 DEV: Convert all uses of exists to qunit-dom (#29667) 2024-11-10 01:30:33 +01:00
b24c8a41ac FIX: remove header-icons from styleguide (#29670)
Recent changes in header makes it complicated to show multiple standalone headers with different state.
2024-11-09 21:58:48 +09:00
0669830a5b FIX: broken post in styleguide (#29669)
The base `transformedPost` in dummy-data was missing the topic object.
2024-11-09 21:46:56 +09:00
20effebd51 DEV: Fix updating header background in webview (#29668)
This regressed in https://github.com/discourse/discourse/pull/28912 for media query changes.
2024-11-08 22:18:09 -05:00
6912a1e3ca UX: Change the authorize button color to primary (#29666)
Primary is a more appropriate color here than "danger". Authorizing is
important, but we usually use "danger" for destructive actions and
nothing is being destroyed here.
2024-11-08 17:33:50 -05:00
c1916f7984 DEV: Convert assert.true(exists()) to qunit-dom (#29638) 2024-11-08 20:27:32 +01:00
3a23ff98bc DEV: Fix passing translatedTitle as argument to flat-button (#29663)
Overriding computed properties with arguments is no longer supported by Ember, so we need to rename this computed property and add fallback logic manually.

This fixes the styleguide 'buttons' page. Ref https://meta.discourse.org/t/styleguide-bugs/335211?u=david
2024-11-08 18:46:05 +00:00
698571e24b DEV: Add --ignore-workspace immediately after 'pnpm' in arguments (#29662)
Adding it to the end means it may get passed to some other tool (e.g. `pnpm eslint` would end up as `pnpm eslint --ignore-workspace`, but we want `pnpm --ignore-workspace eslint`)
2024-11-08 17:54:22 +00:00
cb4b8146a3 Add dedicated user_api_key_clients table to allow for 1:many use cases (#28119) 2024-11-08 12:05:03 -05:00
534e8c1628 UX: update chat channel sorting to include unread threads (#29617)
Adds channels with unread threads (watching/tracking) to the sorting logic for both public and direct message channels.

Previously channels with unread threads could easily be missed as we didn't bump them to the top when new thread replies were created.

We are also adding a blue unread badge next to DM channels when there is an unread thread, as previously they weren't appearing as unread within the DMs tab (they only showed within the My Threads section).
2024-11-08 12:31:03 +04:00
f573fd8f5e FEATURE: Add more bulk dismiss buttons with confirmation (#29331)
When performing bulk dismissal in Unread and New views, the dismiss button stays at the top of the UI. Because of this we want to provide the dismiss action also in the "sticky" menu that's always in view, even when scrolling a long list of topics.
2024-11-08 15:59:12 +08:00
467ecbabf5 FIX: supports escape sequence in chat (#29659)
Writing `\*test\*` will now correctly cook `*test*`, and not `<em>test</em>`.
2024-11-08 15:28:50 +09:00
032b1f871b DEV: cook grid bbcode in chat (#29658)
This change will only prevent a cooked message with [grid] to show [grid] instead the content will be wrapped in `div class="d-image-grid"`. This is only enabled on messages made by bot, as regular users could use grid but have no reason to use it ATM. It will also not apply the decoration which shouldn't change the behavior more than just remove grid markup from the message
2024-11-08 14:43:28 +09:00
af642d0d69 Revert "FEATURE: Mark bad uploads with :invalid_url (#29640)" (#29657)
This reverts commit 5a00a041f1a9a00fb31b18956769262af6f11037.

Implementation is currently not correct. Multiple uploads can share the
same etag but have different paths in the S3 bucket.
2024-11-08 13:04:52 +08:00
4bc030f76f FIX: Add back the option to create invite without emailing (#29641)
Follow-up to a5497b74be

In the linked commit, as part of simplifying the invite modal, we removed the option to skip sending an email when creating an invite restricted to a specific address. This has caused confusion about whether an email will be sent by Discourse or not, so we're adding back the option to create a restricted invite without emailing.

Internal topic: t/134023/48.
2024-11-08 07:59:24 +03:00
6c36af9f62 DEV: Add verbose logging for google oauth (#29459)
Some checks failed
Tests / core frontend (${{ matrix.browser }}) (Chrome) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, plugins) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, themes) (push) Has been cancelled
Licenses / run (push) Has been cancelled
Linting / run (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (annotations, core) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, core) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (backend, plugins) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, plugins) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (frontend, themes) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, chat) (push) Has been cancelled
Tests / ${{ matrix.target }} ${{ matrix.build_type }} (system, core) (push) Has been cancelled
Tests / core frontend (${{ matrix.browser }}) (Firefox ESR) (push) Has been cancelled
Tests / core frontend (${{ matrix.browser }}) (Firefox Evergreen) (push) Has been cancelled
2024-11-08 11:03:17 +08:00
1d9f064d83 FIX: correctly account for composer height in PWA (#29656) 2024-11-08 11:16:15 +09:00
97cf069a06 FIX: S3 custom endpoint incompatible with dualstack (#29654)
Followup 0568d36133081e52f25f05585c1a568c3b828d79

S3 itself and other S3-compatible providers do not
allow using an S3 custom endpoint and dualstack at
the same time, so this commit fixes that by not using
dualstack when the endpoint is present.
2024-11-08 11:12:49 +10:00