Commit Graph

51025 Commits

Author SHA1 Message Date
Roman Rizzi 5683c90917
FIX: TopicSummarization workaround for Postgres' discrete range types (#23105)
Our code assumed the content_range interval was inclusive, but they are open-ended due to Postgres' [discrete range types](https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-DISCRETE), meaning [1,2] will be represented as [1,3).

It also fixes some flaky tests due to test data not being correctly setup and the registry not being resetted after each test.
2023-08-15 14:16:06 -03:00
Godfrey Chan eb4971cb06
DEV: move xss dependency into core (#23094)
This resolves the issue in #23064.

This issue arises because we need to produce the trees for the
auxilary bundles in `ember-cli-build.js` to pass these trees as
argument to `app.toTree()`. In order to produce these trees, the
code internally need to set up babel, which deep-clones the addons'
babel configs.

When using `@embroider/macros`, the addon's babel config includes a
`MacrosConfig` object which is not supposed to be touched until the
configs are "finalized". In a classic build, the finalization step
happens when `app.toTree()` is called. In Embroider, this happens
somewhere deeper inside `CompatApp`.

We need to produce these auxilary bundle trees before we call
`app.toTree()` or before constructing `CompatApp` because they
need to be passed as arguments to these functions. So this poses a
tricky chicken-and-egg timing issue. It was difficult to find a
workaround for this that works for both the classic and Embroider
build pipeline.

Of all the internal addons that uses the auxilary bundle pattern,
this only affets `pretty-text` as it is (for now, at least) the
only addon that uses `@embroider/macros`.

Taking a step back, the only reason (for now, at least) it was
introduced was for the loader shim for the `xss` package. This
package is actually used inside the lazily loaded markdown-it
bundle. However, we didn't have a better way to include the dep
into the lazy bundle directly, so it ends up going into the main
addon tree, and, inturns, the discourse core bundle.

In core's main loader shim manifest, we already have an entry for
`xss`. This was perhaps a mistake at the time, but it doesn't make
a difference – as mentioned above, `xss` needs to be included into
the main bundle anyway.

So, for now, the simpliest solution is to avoid `@embroider/macros`
in these internal addons for the time being. Ideally we would soon
absorb these back into core as lazily loaded (`import()`-ed) code
managed by Webpack when we fully switch over to Embroider.
2023-08-15 16:13:26 +01:00
Roman Rizzi fdfb3a362a
DEV: Make sure max_username_length is within MAX_USERNAME_LENGTH_RANGE (#23104) 2023-08-15 12:12:22 -03:00
Roman Rizzi ee61fe5a2b
DEV: Rewrite username validator specs without hardcoded length limits (#23102) 2023-08-15 11:09:26 -03:00
Joffrey JAFFEUX 2d782c7b00
FIX: correctly deletes webhook_events with webhook (#23097)
Each time a message is created through a webhook, we create we webhook_event associated to this webhook.

When destroying a webhook, we were not destroying the webhook_events which was causing orphans records and more importantly errors in the app expecting to find and associated webhook.
2023-08-15 15:36:00 +02:00
David Taylor e722a14700
FIX: Correct select-kit positioning strategy in modals (#23096)
The new modal API removed the `#discourse-modal` id from the wrapper element, which meant that select-kit couldn't properly detect when it was inside a modal. This commit updates the detection to use `.fixed-modal` which will match both legacy and modern modals.
2023-08-15 10:50:41 +01:00
Sérgio Saquetim 957bff4f5d
DEV: Methods in PageObjects::Pages::User to check nav items (#23095) 2023-08-15 00:11:20 -03:00
dependabot[bot] 23ca3f7e8e
Build(deps-dev): Bump message-bus-client from 4.3.7 to 4.3.8 in /app/assets/javascripts (#23091)
Bumps [message-bus-client](https://github.com/discourse/message_bus) from 4.3.7 to 4.3.8.
- [Changelog](https://github.com/discourse/message_bus/blob/main/CHANGELOG)
- [Commits](https://github.com/discourse/message_bus/compare/v4.3.7...v4.3.8)

---
updated-dependencies:
- dependency-name: message-bus-client
  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>
2023-08-15 10:20:55 +08:00
dependabot[bot] 42991a05ae
Build(deps): Bump message_bus from 4.3.7 to 4.3.8 (#23092)
Bumps [message_bus](https://github.com/discourse/message_bus) from 4.3.7 to 4.3.8.
- [Changelog](https://github.com/discourse/message_bus/blob/main/CHANGELOG)
- [Commits](https://github.com/discourse/message_bus/compare/v4.3.7...v4.3.8)

---
updated-dependencies:
- dependency-name: message_bus
  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>
2023-08-15 10:20:41 +08:00
Sérgio Saquetim 91e5fa506d
DEV: Add @model/@models support in d-navigation-item (#23074) 2023-08-14 17:03:19 -03:00
Isaac Janzen a5542eeab0
DEV: Convert `penalize-user` modal to component-based API (#22960)
<img width="681" alt="Screenshot 2023-08-03 at 12 55 08 PM" src="https://github.com/discourse/discourse/assets/50783505/79cc045a-523d-45a2-8c33-04b556331358">

<img width="763" alt="Screenshot 2023-08-03 at 12 55 05 PM" src="https://github.com/discourse/discourse/assets/50783505/7196a97f-e4f4-4870-b8ac-77255d604c27">

<img width="711" alt="Screenshot 2023-08-03 at 12 55 11 PM" src="https://github.com/discourse/discourse/assets/50783505/a916a85d-8bdb-41fb-8210-1e0c06cf7cf1">
2023-08-14 13:02:54 -05:00
Isaac Janzen ba46b34581
DEV: Convert `badge-preview` modal to component-based API (#22969)
<img width="801" alt="Screenshot 2023-08-03 at 4 00 27 PM" src="https://github.com/discourse/discourse/assets/50783505/f4abc35d-4f3f-47b1-af8d-be36df69fe07">
<img width="486" alt="Screenshot 2023-08-03 at 4 00 15 PM" src="https://github.com/discourse/discourse/assets/50783505/65be7f67-ecfa-4c0c-a1d4-01dfd7452e06">
2023-08-14 12:33:45 -05:00
Mark VanLandingham bd7a10d705
DEV: Skip flakey network disconnected spec (#23087) 2023-08-14 12:24:16 -05:00
Keegan George 61571bee43
UX: Add show more button to long post queued reviewables (#23075) 2023-08-14 10:11:30 -07:00
Isaac Janzen ac4e854a04
DEV: Convert `edit-badge-groupings` modal to component-based API (#22984)
<img width="603" alt="Screenshot 2023-08-04 at 4 43 02 PM" src="https://github.com/discourse/discourse/assets/50783505/033192cc-2c5c-4be6-adde-9dd89b6b05c3">
<img width="594" alt="Screenshot 2023-08-04 at 4 42 59 PM" src="https://github.com/discourse/discourse/assets/50783505/efe8d8fe-f06c-4940-9c99-66a2f8fb3532">
2023-08-14 12:03:28 -05:00
Jordan Vidrine d546f34f2f
FIX: Adjust badge overflow ellipsis (#23086) 2023-08-14 11:10:02 -05:00
Roman Rizzi 5bb2316756
FIX: Topic summary UI fixes. (#23085)
Hide summary wasn't working because it called the wrong action, and we must disabled the summarize button until streaming finishes.
2023-08-14 12:33:12 -03:00
Joffrey JAFFEUX ea6a89397a
UX: ensures user-status-picker’s input is autofocused (#23083)
I tried using "autofocus=true" first but it was not reliable in tests.
2023-08-14 17:19:44 +02:00
Sérgio Saquetim 04c9c81cda
DEV: Added the category chooser into the composer page object (#23076) 2023-08-14 08:18:58 -05:00
David Taylor 643193d2f0
DEV: Resolve user_option deprecation (#23082)
Setting user_options directly on the user object is deprecated (see https://github.com/discourse/discourse/blob/0b56af6f58/app/assets/javascripts/discourse/app/models/user.js#L150-L165). We're already setting it in the correct way a few lines later, so this line can be removed.
2023-08-14 13:19:03 +01:00
dependabot[bot] 0b56af6f58
Build(deps-dev): Bump eslint from 8.46.0 to 8.47.0 in /app/assets/javascripts (#23081)
Bumps [eslint](https://github.com/eslint/eslint) from 8.46.0 to 8.47.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.46.0...v8.47.0)

---
updated-dependencies:
- dependency-name: eslint
  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>
2023-08-14 13:45:18 +08:00
dependabot[bot] 7290cd6715
Build(deps): Bump rss from 0.2.9 to 0.3.0 (#23079)
Bumps [rss](https://github.com/ruby/rss) from 0.2.9 to 0.3.0.
- [Release notes](https://github.com/ruby/rss/releases)
- [Changelog](https://github.com/ruby/rss/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rss/compare/0.2.9...0.3.0)

---
updated-dependencies:
- dependency-name: rss
  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>
2023-08-14 13:44:23 +08:00
dependabot[bot] 9a05b906ea
Build(deps): Bump nokogiri from 1.15.3 to 1.15.4 (#23080)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.15.3 to 1.15.4.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.15.3...v1.15.4)

---
updated-dependencies:
- dependency-name: nokogiri
  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>
2023-08-14 13:44:12 +08:00
Natalie Tay aa7917d533
DEV: Add some description to help with understanding flakey test failures (#23053) 2023-08-14 12:19:05 +08:00
Roman Rizzi 7ca5ee6cd2
FEATURE: Stream topic summaries. (#23065)
When we receive the stream parameter, we'll queue a job that periodically publishes partial updates, and after the summarization finishes, a final one with the completed version, plus metadata.

`summary-box` listens to these updates via MessageBus, and updates state accordingly.
2023-08-11 15:08:49 -03:00
Renato Atilio 840bea3c51
FEATURE: add topic voting webhook event type (#23072)
* FEATURE: add topic upvote webhook event type

* DEV: use a generic event type name for other actions in the same plugin
2023-08-11 13:42:28 -03:00
David Taylor 6de4b3ac3f
DEV: Remove OpenComposer mixin and refactor related logic (#23015)
The OpenComposer mixin comes from a time before we had a composer service. As well as being a general cleanup/refactor, this commit aims to removes interlinking between composer APIs and the discovery-related controllers which are being removed as part of #22622.

In summary, this commit:
- Removes OpenComposer mixin
- Adds and updates composer service APIs to support everything that `openComposer` did
- Updates consumers to call the composer service directly, instead of relying on the mixin (either directly, or via a route-action which bubbled up to some parent)
- Deprecates composer-related methods on `DiscourseRoute` and on the application route
2023-08-11 09:53:44 +01:00
Joffrey JAFFEUX 31626ce85d
FIX: prevents user-tips to interfere with widget (#23066)
Prior to this fix the user tip was rendered with panels and interfering with widget code. I suspect it was causing the widget node  (revamped-hamburger-menu-wrapper) to not be removed, as a result clickOutside would be called two times, negating the effect of the click.

This fix is just rendering the tip in a different node, preventing the interference, it shouldn't impact behavior as the positioning is absolute.
2023-08-11 10:41:39 +02:00
Ted Johansson 8053cb0c21
DEV: Add a HasDeprecatedColumns concern for better deprecation messages (#22930)
Currently when we decide we're going to drop a column in the future we just mark it with a TODO comment and add it to ignored_columns. This makes it instantly unavailable, and we mostly forget about the TODO in the end. 😬

This change adds a HasDeprecatedColumns concern which offers a little bit more flexibility. We can still simulate the old behaviour by setting drop_from to the current version, but we can also set it to a future version, causing it to raise a deprecation warning until then if used.
2023-08-11 15:25:44 +08:00
Jean 918be1dd63
FEATURE: add a param to exclude users by groups on the users directory page (#23067) 2023-08-11 11:45:33 +08:00
Martin Brennan fb36af7799
DEV: Move calendar date + time picker from local dates into core component (#23023)
This commit moves the calendar date and time picker shown in
the local dates modal into a core component that can be reused
in other places. Also add system specs to make sure there isn't
any breakages with this feature, and a section to the styleguide.
2023-08-11 13:05:44 +10:00
Alan Guo Xiang Tan 0187ad0d37
DEV: Upgrade Rails to 7.0.7 (#23069) 2023-08-11 09:00:42 +08:00
dependabot[bot] bc32641a36
Build(deps-dev): Bump sass from 1.65.0 to 1.65.1 in /app/assets/javascripts (#23068)
Bumps [sass](https://github.com/sass/dart-sass) from 1.65.0 to 1.65.1.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.65.0...1.65.1)

---
updated-dependencies:
- dependency-name: sass
  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>
2023-08-11 08:29:14 +08:00
Jarek Radosz e91fa0ef80
DEV: Convert user-tips functions into a service (#23032)
The original motivation for this change was to avoid mutating imported modules (by stubbing imported functions in tests)

Other than that it's a good practice to place code like this in services, especially (although not the case here) if it requires access to other services or controller.
2023-08-10 16:41:46 +02:00
Jarek Radosz 822ecdc91a
DEV: Migrate jump-to-post to the new modal api (#23058) 2023-08-10 16:40:32 +02:00
Joffrey JAFFEUX 7358856ae7
FIX: chat styleguide modal import (#23062) 2023-08-10 15:55:28 +02:00
Jarek Radosz 8bebd8fd99
DEV: Format .thor files (#23059) 2023-08-10 13:59:13 +02:00
tshenry 5e72f2a342
DEV: Add jira plugin to official list of plugins (#22997)
https://github.com/discourse/discourse-jira
2023-08-10 03:25:22 -07:00
Jarek Radosz bc26e6c4b2
DEV: Migrate insert-hyperlink to the new modal api (#23051) 2023-08-10 12:09:26 +02:00
Isaac Janzen c280c1c52b
DEV: Convert `site-setting-default-categories` modal to component-based API (#22968) 2023-08-10 10:31:34 +01:00
Godfrey Chan e7dee94c5c
Upgrade ember-on-resize-modifier (#23045)
The previous version of ember-on-resize-modifier depended on
ember-modifier@^3.2.7 while discourse had ember-modifier@^4.1.0.

As far as Yarn is concerned, it can accomplish this with:

node_modules
  ...
  ember-modifier 4.1.0
  ...
  ember-on-resize-modifier 1.1.0
    ...
    ember-modifier 3.2.7
    ...
  ...

This does NOT work!

In a classic build everything is compiled down to AMD modules and
at runtime there can only be one uniquely named "ember-modifier"
module. When we have duplicates, depending on activation ordering,
one of them will randomly win.

In practice, it seems like ember-modifier 3.2.7 had "won" in the
current build, and we are shipping it to production, you can find
these modules in vendor.js like:

```js
;define("ember-modifier/-private/class/modifier", /* ... */, function(/* ... */) {
  /* the 3.2.7 version with deprecations, etc */
})
/* ... */
;define("ember-modifier/index", /* ... */)
```

However, ember-auto-import also "found" the 4.1.0 version and in
one of the chunk.app.js:

```js
d('ember-modifier', /* ... */, function() { return __webpack_require__(/*! ember-modifier */ 227); });
```

...and in one of the chunk.vendors.js...

```js
/* 227 */
/*!****************************************************!*\
  !*** ../node_modules/ember-modifier/dist/index.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";

/* ...the 4.1.0 version... */

}),
```

So, in practice:

* We are brining both copies into the production build
* The 3.2.7 modules are available in the AMD loader as "ember-modifier/..."
* But 4.1.0 modules are available in the AMD loader as "ember-modifier"
* Because mostly it's consumed as `import ... from "ember-modifier";`, the
  latter end up actually winning
* Because the newer code is compatible enough, and the deprecated features
  are unused, it seems to work ok..?

But in the Embroider build, ember-auto-import doesn't emit those shims
anymore. It does process most of the core modules through Webpack so the
imports get correctly wired up to the 4.1.0 as expected, as they no longer
go through/need the runtime AMD loader.js.

The older 3.2.7 copy is _still_ shipped in the vendor bundle and registered
the same, but not "stomped over" by the EAI shims anymore. Our manual shims
(#22703, merged yesterday) are more "polite" and check `require.has(...)`
before defining the module, and since `require.has(...)` check for the
`/index` alias and returns `true`, our shim does not stomp the 3.2.7 modules
either.

So then, when our "auxilary bundles" (admin, plugins, etc) tries to import
`"ember-modifier", they get the 3.2.7 version.
2023-08-10 10:28:39 +01:00
chapoi cd5a9a2775
UX: add transition (#23034) 2023-08-10 10:28:59 +02:00
chapoi ca1671023a
UX: align tags to top in modal (#23055)
* UX: align tags to top in modal

* UX: fix alignment in grid with multiple rows
2023-08-10 10:26:25 +02:00
chapoi bda3ead644
UX: prevent overscroll behaviour in composer (#23056) 2023-08-10 10:23:41 +02:00
Martin Brennan 2ecc8291e8
DEV: Remove unnecessary chat hashtag/mention transform JS (#23054)
Not sure when we added this but it is no longer necessary,
hashtags are cooked appropriately when sending chat messages
and the mention transform was not used anywhere.
2023-08-10 09:31:41 +02:00
dependabot[bot] f32c95c1b9
Build(deps-dev): Bump rubocop-rspec from 2.23.1 to 2.23.2 (#23050)
Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.23.1 to 2.23.2.
- [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/v2.23.1...v2.23.2)

---
updated-dependencies:
- dependency-name: rubocop-rspec
  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>
2023-08-10 02:19:23 +02:00
dependabot[bot] fd41b67316
Build(deps-dev): Bump rubocop from 1.55.1 to 1.56.0 (#23049)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.55.1 to 1.56.0.
- [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.55.1...v1.56.0)

---
updated-dependencies:
- dependency-name: rubocop
  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>
2023-08-10 02:17:51 +02:00
Jarek Radosz 94649565ce
DEV: Correct `Style/RedundantReturn` rubocop issues (#23052) 2023-08-10 02:03:38 +02:00
Alan Guo Xiang Tan 7954d34448
DEV: Clean up more state in between system tests (#23009)
Why this change?

By default in the test environment, MessageBus used the memory backend
which means all messages are stored in an in-memory data structure. However,
the in-memory data structure is not cleared after each system test so we
have the potential to be leaking stuff between system tests.

Similarly for the defer queue which process work in another thread, we
want to ensure that the defer queue processes everything it has to do
before the transaction is rolled back.
2023-08-10 07:32:27 +08:00
Blake Erickson 8ce7f260d7
DEV: Fix user update api docs (#23047) 2023-08-09 16:56:10 -06:00