Commit Graph

21069 Commits

Author SHA1 Message Date
David Taylor
121cd886a4
PERF: Improve rendering performance of empty PluginOutlets (#23165)
This commit introduces a 'shortcut' when rendering PluginOutlets which have no registered connectors. On my machine, this improves rendering performance of empty PluginOutlets by around 30-40% (tested by running tachometer on a `/latest` route with 600 plugin outlets).
2023-08-21 13:42:59 +01:00
Jarek Radosz
c48e29db02
DEV: Use object spread instead of Object.assign({}, …) (#23167)
Same behavior, more consistent and concise code.
2023-08-21 14:28:16 +02:00
dependabot[bot]
db40941deb
Build(deps): Bump ember-cli-babel in /app/assets/javascripts (#23157)
Bumps [ember-cli-babel](https://github.com/babel/ember-cli-babel) from 7.26.11 to 8.0.0.
- [Release notes](https://github.com/babel/ember-cli-babel/releases)
- [Changelog](https://github.com/babel/ember-cli-babel/blob/master/CHANGELOG.md)
- [Commits](https://github.com/babel/ember-cli-babel/compare/v7.26.11...v8.0.0)

---
updated-dependencies:
- dependency-name: ember-cli-babel
  dependency-type: direct:production
  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>
2023-08-21 11:27:24 +02:00
dependabot[bot]
42bcec6c79
Build(deps-dev): Bump sass in /app/assets/javascripts (#23156)
Bumps [sass](https://github.com/sass/dart-sass) from 1.66.0 to 1.66.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.66.0...1.66.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-21 11:01:16 +02:00
Kris
2a49757f35
UX: update /new toggle styles, class names (#23154)
* Minor style adjustments
* Removes "all" count because it's redundant to the count on New
* Updates generic class names with -- modifier to follow BEM and help avoid class name collisions
* Hides the toggle when bulk select is enabled (the UI ends up being too busy)
2023-08-21 09:34:12 +08:00
Joffrey JAFFEUX
b2b84cc957
FEATURE: implements user based sidebar mode (#23078) 2023-08-18 20:33:07 +02:00
Mark VanLandingham
291749e35b
DEV: Move PluginOutlet at bottom of TopicNavigation (#23149) 2023-08-18 11:41:09 -05:00
Joffrey JAFFEUX
4661bcb5ea
FIX: correctly makes this accessible in the scope (#23146) 2023-08-18 17:20:59 +02:00
Kris
51e369a2c6
UX: update admin popular theme list (#23134) 2023-08-18 09:07:25 -04:00
David Taylor
16c6ab8661
DEV: Allow plugin outlets to be defined using gjs (#23142)
Previously we were discovering plugin outlets by checking first for dedicated template files, and then looking for classes to match them. This doesn't work for components which are entirely defined in JS (e.g. those authored with gjs, or those which are re-exports of a colocated component).

This commit refactors our detection logic to look for both class and template modules in a single pass. It also refactors things so that the modules themselves are required lazily when needd, rather than all being loaded during app boot.
2023-08-18 12:07:10 +01:00
dependabot[bot]
b99565450d
Build(deps-dev): Bump sass from 1.65.1 to 1.66.0 in /app/assets/javascripts (#23138)
Bumps [sass](https://github.com/sass/dart-sass) from 1.65.1 to 1.66.0.
- [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.1...1.66.0)

---
updated-dependencies:
- dependency-name: sass
  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-18 12:44:40 +08:00
Osama Sayegh
09d3709ec9
FEATURE: New topics vs replies toggle for the new new view (#22920)
This PR adds a new toggle to switch the (new) /new list between showing topics with new replies (a.k.a unread topics), new topics, or everything mixed together.
2023-08-18 12:44:04 +08:00
Ella E
9d7254184c
UX: remove border radius on tippy (#23133)
* UX: remove border radius on tippy

* DEV: use border radius var
2023-08-17 20:53:28 -06:00
Ella E
49a54d4cee
UX: remove boostrap mode rounded corners (#23132) 2023-08-17 14:59:45 -06:00
Roman Rizzi
53407f956c
FIX: Inject currentUser service for related-messages (#23128) 2023-08-17 16:08:38 -03:00
Roman Rizzi
af30f9945a
UX: Use pill design on both mobile and desktop (#23124) 2023-08-17 14:37:11 -03:00
Joffrey JAFFEUX
95c4d97db3
FIX: do not mutate this.attrs and this.actions (#23125)
Prior to this fix we would always re-set `this.attrs` with `this.attrs` when defined, which is both wasteful but also dangerous as `this.attrs` can possibly error when mutated.
2023-08-17 18:07:06 +02:00
David Taylor
712bbf9b88
DEV: Convert discovery-sortable and tag-show to native class syntax (#23123) 2023-08-17 15:32:51 +01:00
David Taylor
5a99243629
DEV: Introduce declarative hide-application-footer helper (#23088)
Previously, we had a `showFooter` boolean on the application controller which would be set true/false in various routes by different routes/controllers. A global `routeWillChange` hook would set it `false` before every route transition, and the destination route/controller would have to set it `true` for the footer to show correctly.

This commit replaces that with a new 'declarative' system. Instead of having to set the value true/false manually, UIs which need the footer to be hidden can simply include the `{{hide-application-footer}}` helper in their template when needed. The helper/service will automatically keep track of all the current invocations of that helper, and only show the footer when there are 0 invocations.

This significantly simplifies things, and removes the need for many observers and controller injections, both of which are considered 'code smells' in modern Ember applications.
2023-08-17 12:47:08 +01:00
Krzysztof Kotlarek
f8cd1da92a
FIX: increase sidebar URL limit to 1000 (#23120)
Before this change, sidebar URL had a limit of 200 characters. In some cases it is not enough, therefore it was increased to 1000.
2023-08-17 14:46:24 +10:00
Alan Guo Xiang Tan
20840c341f
FIX: /filter route input field not updating on route change (#23119)
What is the problem here?

When transiting between `/filter` routes with different `q` query
params, the input field is not updating to include the values in the `q`
query param. This was because we were setting the value of the input
field in the constructor of the controller but controllers are actually
singletons in Ember so setting the value of the input field is only done
once when the controller is initialised.

What is the fix here?

Instead of setting the value of the input field in the controller, we
set the value in the `setupController` hook in the route file.
2023-08-17 09:04:48 +08:00
marstall
77626c088e
UX: support links in tag descriptions (#22994)
* scrub non-a html tags from tag descriptions on create, strips all tags from tag description when displayed in tag hover

* test for tag description links

* UX: basic render-tag test

* UX: fix linting

* UX: fix linting

* fix broken tests

* Update spec/models/tag_spec.rb

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>

* UX: use has_sanitizable_fields instead of has_scrubbable_fields to ensafen tag.description

---------

Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
2023-08-16 11:43:54 -04:00
David Taylor
f3cc294470
FIX: Avoid double-counting pageviews when navigating with loading spinner (#23107)
104baab5 fixed double-counted pageviews for the initial page load. Under the default 'loading slider' implementation, that resolved all the known problems.

However, under the 'loading spinner', there is an additional problem. In 'spinner' mode, each navigation within the JS app involves transitioning to an intermediate 'loading' route. Previously, this intermediate state was being treated as a separate page by the app, and so any ajax requests fired during it would be counted as a distinct pageview. One known case of this is the `/presence/get` request which is made when logged-in users visit a topic.

This commit updates the logic to ignore 'intermediate' transitions, and introduces regression tests for both the 'spinner' and 'slider' modes.
2023-08-15 22:30:37 +01:00
Mark VanLandingham
51a976eab9
FIX: Display 'shown on X' user field flags (#23109)
In this commit 2.5 years ago, variables for showOnUserCard and showOnProfile were removed, but we still used them in the component. e29605b

This corrects the variable names and adds a test to confirm the text is now shown.
2023-08-15 15:59:04 -05:00
Renato Atilio
a33c878b55
DEV: allow to skip the configured form template via the composer service (#23108)
* DEV: allow `formTemplateIds` to be explicitly set via the composer service

* DEV: allow to skip the configured form template via the composer service
2023-08-15 17:03:38 -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
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
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
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
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
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
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
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
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
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
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
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