Commit Graph

17445 Commits

Author SHA1 Message Date
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
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
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
Jarek Radosz
2a7eb3d5b5
DEV: Migrate forgot-password to the new modal api (#23041) 2023-08-10 00:45:06 +02:00
Krzysztof Kotlarek
e835a91199
DEV: API to show and hide switch panel buttons (#23022)
There is a case when developer would like to go to separated mode but not show switch panel buttons. We need additional functions to show/add buttons to support this case.
2023-08-10 08:43:35 +10:00
dependabot[bot]
067579882c
Build(deps-dev): Bump sass in /app/assets/javascripts (#23048)
Bumps [sass](https://github.com/sass/dart-sass) from 1.64.2 to 1.65.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.64.2...1.65.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-10 00:34:38 +02:00
Roman Rizzi
b832786f35
REFACTOR: Glimmerify topic summarization widgets. (#23043)
* REFACTOR: Glimerify topic summarization widgets.

Simplifies all the logic for generating/regenerating summaries and expanding/collapsing the summary box. It makes streaming easier to implement since now we can subscribe to message bus directly from the component.

* Update app/assets/javascripts/discourse/app/components/summary-box.hbs

Co-authored-by: David Taylor <david@taylorhq.com>

* Update app/assets/javascripts/discourse/app/components/summary-box.hbs

Co-authored-by: David Taylor <david@taylorhq.com>

* Update app/assets/javascripts/discourse/app/components/summary-box.hbs

Co-authored-by: David Taylor <david@taylorhq.com>

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-08-09 17:11:24 -03:00
Jarek Radosz
993ed10cf0
DEV: Don't stub logout function (#23039) 2023-08-09 18:20:43 +02:00
Mark VanLandingham
ab3a9b4690
DEV: Add plugin outlet after TopicNavigation (#23038) 2023-08-09 09:49:28 -05:00
Godfrey Chan
923b51ad25
DEV: add loader.js shims for packages used across bundles (#22703)
This adds a new `loaderShim()` function to ensure certain modules
are present in the `loader.js` registry and therefore runtime
`require()`-able.

Currently, the classic build pipeline puts a lot of things in the
runtime `loader.js` registry automatically. For example, all of
the ember-auto-import packages are in there.

Going forward, and especially as we switch to the Embroider build
pipeline, this will not be guarenteed. We need to keep an eye on
what modules (packages) our "external" bundles (admin, wizard,
markdown-it, plugins, etc) are expecting to be present and put
them into the registry proactively.
2023-08-09 12:04:41 +01:00
dependabot[bot]
048796e678
Build(deps): Bump a11y-dialog in /app/assets/javascripts (#23028)
Bumps [a11y-dialog](https://github.com/KittyGiraudel/a11y-dialog) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/KittyGiraudel/a11y-dialog/releases)
- [Commits](https://github.com/KittyGiraudel/a11y-dialog/compare/8.0.0...8.0.1)

---
updated-dependencies:
- dependency-name: a11y-dialog
  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-09 11:47:43 +02:00
dependabot[bot]
fcc69b497a
Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#23004)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.9 to 7.22.10.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.22.10/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/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>
2023-08-09 11:47:12 +02:00
dependabot[bot]
f90445682e
Build(deps): Bump ember-cli-htmlbars in /app/assets/javascripts (#23021)
Bumps [ember-cli-htmlbars](https://github.com/ember-cli/ember-cli-htmlbars) from 6.2.0 to 6.3.0.
- [Release notes](https://github.com/ember-cli/ember-cli-htmlbars/releases)
- [Changelog](https://github.com/ember-cli/ember-cli-htmlbars/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-cli-htmlbars/compare/v6.2.0...v6.3.0)

---
updated-dependencies:
- dependency-name: ember-cli-htmlbars
  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-09 11:26:42 +02:00
Penar Musaraj
cb5ae4dcfa
FIX: Search by tag context was broken (#23006) 2023-08-08 15:15:34 -04:00
Mark VanLandingham
1b63e046af
DEV: Plugin API method to replace post-menu buttons (#22995) 2023-08-08 14:00:45 -05:00
Jordan Vidrine
4d2d31e68a
Revert "UX: Simplify and redesign summary skeleton (#22965)" (#23012)
This reverts commit bd19f0c9f1.
2023-08-08 07:55:37 -05:00
David Taylor
655e99491a
DEV: Convert discovery routes to native class syntax (#23010) 2023-08-08 13:52:34 +01:00
Renato Atilio
904ab8deaa
FIX: avoid eager rewrite of /my* routes (#23011) 2023-08-08 09:43:41 -03:00