Commit Graph

29950 Commits

Author SHA1 Message Date
David Taylor eb94ec16da
DEV: introduce Ember `<template>` tag support (.gjs) (#22719)
The gjs/gts formats are a new pattern for authoring Ember components. This commit introduces support for these patterns to our build pipeline for core/plugins, and converts a handful of components to use the new format. It also introduces relevant updates to our linting config, and to our sample vscode configuration.

Co-authored-by: Godfrey Chan <godfreykfc@gmail.com>
Co-authored-by: Krystan HuffMenne <kmenne+github@gmail.com>
2023-07-20 21:01:12 +01:00
Jarek Radosz 9bbd5efbec
DEV: Convert helpers into plain functions (#22385)
Since 0fa92529ed, helpers can now be implemented as plain JS functions. This makes them much easier to write/read, and also makes them usable in `<template>` gjs files.
2023-07-20 19:45:40 +01:00
Roman Rizzi 238d71bcad
FEATURE: Regenerate outdated summaries. (#22718)
Users unable to generate new summaries won't be able to regenerate them. They'll only see the warning saying it's outdated.
2023-07-20 15:25:46 -03:00
David Battersby 88dc6afe64
DEV: skip flaky lightbox loading state test (#22709)
Skips a flaky test for the new lightbox loading state.
2023-07-20 11:00:22 +08:00
Krzysztof Kotlarek 3355298f9f
FEATURE: ability to position switch panel buttons (#22707)
SiteSetting which allow to position switch panels buttons at the top or the bottom of the Sidebar.
2023-07-20 12:52:46 +10:00
Ted Johansson 9a6bbac5bd
DEV: migrate ignore duration to Glimmer and DModal (#22687)
This PR migrates the ignore modal to a Glimmer component and DModal. Most of the code is lift-and-shift.
2023-07-20 10:49:58 +08:00
Krzysztof Kotlarek 117f6d92a8
FEATURE: allow sidebar section api to create external links (#22609)
* FEATURE: allow sidebar section api to create external links

Right now, sidebar API allows creating sections with internal links. It should be extended to allow creating links to external URLs as well.

* FIX: after rebase
2023-07-20 09:07:18 +08:00
Jarek Radosz b105c6c510
DEV: Remove the last/only use of inline-date helper (#22692)
See: https://github.com/discourse/discourse/pull/22385
2023-07-19 21:13:40 +02:00
Roman Rizzi 9650bf9d08
DEV: disambiguate system spec find to prevent flakyness (#22698) 2023-07-19 15:57:23 -03:00
Godfrey Chan e1d27400f5
DEV: refactor ember-cli-build (#22694)
pass the extra public trees to `app.toTree()` to match:

0e00f2bf15/packages/test-setup/src/index.ts (L24-L27)

The ember-cli-terser addon now takes care of minifying all additional trees, so we can remove our custom terser-related logic
2023-07-19 17:48:20 +01:00
Roman Rizzi 132bd375f6
UX: Show the info icon outside the tooltip (#22696) 2023-07-19 13:33:17 -03:00
Godfrey Chan a295298649
DEV: update index.html files (#22695)
This brings them more in line with an idiomatic ember app looks
like, in particular, embroider really expects the CSS file to be
there.

As far as I can tell this is fairly harmless, since in production
the actual HTML is generated and served by Rails anyway.

Down the road, this may also be a good alternative to hacking the
build pipeline to bring in styles for tests.
2023-07-19 17:31:08 +01:00
Isaac Janzen 1561e51a13
DEV: Revert "DEV: Update `replaceWith` on Route (#22645)" (#22693)
This reverts commit 33db93c9b2.
2023-07-19 10:47:31 -05:00
Ted Johansson 341acacba8
DEV: Add endpoint for dismissing outdated translations (#22509)
Recently we started giving admins a notice in the advice panel when their translations have become outdated due to changes in core. However, we didn't include any additional information.

This PR adds more information about the outdated translation inside the site text edit page, together with an option to dismiss the warning.
2023-07-19 23:06:13 +08:00
Roman Rizzi 3820fae041
UX: Disclose AI model used and add animation to placeholder (#22670)
* UX: Disclose AI model used and add animation to placeholder

* Move text into hbs template

DTooltip (weirdly) attaches to a sibling element, so we need something else to be rendered inside the RenderGlimmer wrapper div

---------

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-19 12:03:36 -03:00
Jarek Radosz 00ab94bf53
DEV: Migrate topic-bulk-actions to the new modal API (#22690) 2023-07-19 15:27:51 +02:00
David Taylor 6fd06bc411
FIX: Ensure 'modern' modal is closed when opening legacy modal (#22689)
e.g. the modernised share-topic modal will attempt to open the `create-invite` modal. Prior to this commit, this mixing of modern/legacy would fail silently, and the create-invite modal was never shown.
2023-07-19 12:22:00 +01:00
Sam e5bb4bbd59
FIX: banners not removing when unset (#22678)
Initializing an EmberObject with a null object leads to an exception. This commit stops that from happening, and introduces an acceptance test for adding/removing banner topics via message-bus.

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-19 11:57:52 +01:00
David Taylor 125903f682
FIX: Staff action log could not be accessed via link (#22688)
011ba5b9 slightly changed the way the staff-action-log route is activated. It's now possible for `deserializeQueryParam` to be called with a null value, so we need to deal with that case.

This route is currently untested - we'll follow-up with another commit to add some.
2023-07-19 11:40:48 +01:00
Jarek Radosz bdd97ff931
DEV: Convert fast-edit on mobile to a modal (#22570)
Motivation: to fix an issue with fast-edit positioning on mobile (android) Trying to correctly position that textarea/popper element proved difficult

see: https://meta.discourse.org/t/fast-edit-input-container-position/263190
2023-07-19 11:43:00 +02:00
Jarek Radosz 70cebfb6ab
DEV: Skip hidden elements in J / K navigation (#22671) 2023-07-19 11:41:18 +02:00
Ted Johansson c2e90f8c07
DEV: Migrate publish page modal to Glimmer and DModal (#22663)
This PR migrates the publish page modal to a Glimmer component and DModal.

Most of the code is lift-and-shift. However, the component state getters were implemented using meta-programming in the original controller. They have all been inlined here for clarity, searchability, etc.
2023-07-19 10:37:07 +08:00
Krzysztof Kotlarek 20ec7ac174
FEATURE: new API to add panels to sidebar (#22534)
Define new concept of panels in sidebar. Panels are wrappers around sidebar sections. In the future, it allows creating full focus mode by switching between panels.

A new API method called addSidebarPanel was added. Default main panel is already registered and by default all API sections are mounted to main.
2023-07-19 11:31:45 +10:00
Martin Brennan 54001060ea
FIX: Termless hashtag search when a type is disabled (#22660)
When a type was disabled, the hashtag search _without_ a
term was erroring. This was because we weren't filtering
out the disabled types from types_in_priority_order first
like we were if there was a term provided.

This commit fixes that issue, and also makes it so
contexts_with_ordered_types and ordered_types_for_context
will only return hashtag types which are enabled.
2023-07-19 10:10:33 +10:00
Isaac Janzen bd88b7d6c4
DEV: Remove `transition-methods` deprecation (#22673)
All https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods deprecations have been resolved.
2023-07-18 16:09:28 -05:00
Isaac Janzen 72edb7270c
DEV: Upgrade `replaceRoute` on Controller (#22648)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.replaceRoute` calls on controllers to directly call the router service (`this.router.replaceRoute`)
2023-07-18 15:16:41 -05:00
Isaac Janzen 33db93c9b2
DEV: Update `replaceWith` on Route (#22645)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.replaceWith` calls on routes to directly call the router service (`this.router.replaceWith`)
2023-07-18 15:05:53 -05:00
Juan David Martínez Cubillos 7422fe7c3f
FIX: Embedding checkbox bug (#22672) 2023-07-18 15:02:07 -05:00
Isaac Janzen a2ea9c5417
DEV: upgrade `transitionToRoute` on Controller (#22647)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.transitionToRoute` calls on controllers to directly call the router service (`this.router.transitionTo`)
2023-07-18 14:53:23 -05:00
Isaac Janzen 011ba5b9f6
DEV: Update `transitionTo` on Route (#22644)
Per https://deprecations.emberjs.com/v3.x/#toc_routing-transition-methods

We are upgrading all `this.transitionTo` calls on routes to directly call the router service (`this.router.transitionTo`)
2023-07-18 14:52:55 -05:00
Penar Musaraj bd7e5c15fb
UX: Fix focus state style for date button in composer (#22669) 2023-07-18 15:39:52 -04:00
Jean defa8904b9
FEATURE: Add limit and group exclusion to the directory items endpoint (#22667)
* FEATURE: Add limit and group exclusion to the directory items endpoint
2023-07-18 15:09:32 -04:00
Jarek Radosz 2a96064e6b
DEV: Modernize topic-bulk-actions (#22186)
Introduces new plugin api for adding bulk topic actions:

Example:

```js
api.addBulkActionButton({
  label: "super_plugin.bulk.enhance",
  icon: "magic",
  class: "btn-default",
  visible: ({ currentUser, siteSettings }) => siteSettings.super_plugin_enabled && currentUser.staff,
  async action({ setComponent }) {
    await doSomething(this.model.topics);
    setComponent(MyBulkModal);
  },
});
```
2023-07-18 20:10:16 +02:00
Godfrey Chan 3c69570b75
DEV: move deprecation silencer to a shared package (#22668)
This babel plugin is intended to supress the deprecation warnings
from building plugins, however, discourse-plugins does not actually
consume this plugin at all. Currently this happens to work due to
how the babel worker processes are shared and the timing/ordering
of the build, but it will stop working with the embroider build.

This commit extracts the plugin the a shared package so that it
can be properly consumed by discourse-plugins as well as core.
2023-07-18 19:07:20 +01:00
Isaac Janzen 5fbce985a8
DEV: Convert create-invite-bulk modal to component-based API (#22549)
This PR converts the `create-invite-bulk` modal to make use of the new component-based API
2023-07-18 12:31:32 -05:00
Isaac Janzen 6ba8259918
DEV: Add loading spinner to history modal (#22666)
https://github.com/discourse/discourse/assets/50783505/b5f510a8-719c-461c-a02f-a8b3a8573466
2023-07-18 12:30:27 -05:00
Selase Krakani 3d554aa10e
FIX: Keep ReviewableQueuedPosts even with user delete reviewable actions (#22501)
Performing a `Delete User`/`Delete and Block User` reviewable actions for a
queued post reviewable from the `review.show` route results in an error
popup even if the action completes successfully.

This happens because unlike other reviewable types, a user delete action
on a queued post reviewable results in the deletion of the reviewable
itself. A subsequent attempt to reload the reviewable record results in
404. The deletion happens as part of the call to `UserDestroyer` which
includes a step for destroying reviewables created by the user being
destroyed. At the root of this is the creator of the queued post
being set as the creator of the reviewable as instead of the system
user.

This change assigns the creator of the reviewable to the system user and
uses the more approapriate `target_created_by` column for the creator of the
post being queued.
2023-07-18 11:50:31 +00:00
dependabot[bot] 3a1dc7ec6d
Build(deps-dev): Bump webpack in /app/assets/javascripts (#22662)
Bumps [webpack](https://github.com/webpack/webpack) from 5.88.1 to 5.88.2.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.88.1...v5.88.2)

---
updated-dependencies:
- dependency-name: webpack
  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-07-18 11:35:46 +02:00
David Taylor 8f17b85de6
DEV: Set ember edition to Octane (#22623)
- explicitly enables the jquery-integration. This was previously enabled by default, so no change in behavior for us

- enable template-only-glimmer-components. In core, we don't have any component templates under `templates/components`, so this flag has no effect. A shim, with associated tests, is introduced to preserve the old template-only 'classic component' behavior for themes and plugins.
2023-07-18 10:00:19 +01:00
David Taylor be62c3e323
DEV: Unsilence legacy modal deprecation (#22634)
We'd like to get this deprecation unsilenced before the 3.1 release so that theme/plugin developers see the messages and can make the necessary changes during the 3.2 release cycle. To avoid the remaining legacy core modals from creating overwhelming noise in the logs, deprecation messages for them are skipped.
2023-07-18 09:58:35 +01:00
David Taylor 104baab557
FIX: Do not track first AJAX request as a pageview (#22661)
When the app boots, Ember fires a `routeWillChange` event. This was causing us to set the `_trackView` flag in our ajax library, which would cause the next request to have the `Discourse-Track-View` header, despite not being relevant to the page view. Depending on the plugins/themes installed, this could lead to 'double counting' of pageviews. (because the initial HTML request is also counted as a page view)

This commit updates the the logic to ignore the first transition (by checking `transition.from`), and also introduces an acceptance test for the behaviour.

Co-authored-by: Régis Hanol <regis@hanol.fr>
2023-07-18 09:58:01 +01:00
David Battersby 3c1dd4a62c
FIX: check if dominant color is set before updating site theme color (#22658)
Currently the dominant color attribute is only set for post images (not chat).
As a result, clicking lightbox images in chat will load the image within lightbox but also shows a JS error.
This change ensures that the dominant color is set before attempting to update the site theme color.
2023-07-18 12:14:58 +08:00
Ted Johansson 72ea73988c
DEV: Add missing report filter type in bookmarks report (#22616)
Adding a filter without a type parameter has been deprecated for the last three years, and was marked for removal in 2.9.0.

During this time we have had a few deprecation warnings in logs coming from Reports::Bookmarks.

The fallback was to set the type to the name of the filter. This change just passes the type (same as name) explicitly instead, and removes the deprecation fallback.
2023-07-18 11:07:01 +08:00
Ted Johansson 7c0534c292
DEV: Replace raw comments with deprecation warnings (#22617)
We have a number of raw comments indicating that certain methods and classes are deprecated and marked for removal. This change turn those comments into deprecation warnings so that we can 1) see them in the logs of our own hosting and 2) give some warning to self hosters.
2023-07-18 10:13:40 +08:00
Krzysztof Kotlarek b719688887
FIX: sometimes stuck of sidebar reorder (#22654)
When the mouse was moved quickly, the browser stayed in drag and drop mode and an additional click was required to exit drag and drop mode.
2023-07-18 11:56:43 +10:00
Alan Guo Xiang Tan 3da6759860
FEATURE: Add admin dashboard warning for `legacy` navigation menu (#22655)
Why this change?

The `legacy` navigation menu option for the `navigation_menu` site
setting will be removed shortly after the release of Discourse 3.1 in
the first beta release of Discourse 3.2. Therefore, we're adding an
admin dashboard warning to give sites on the `legacy` navigation menu a
heads up.
2023-07-18 09:41:38 +08:00
Martin Brennan b583872eed
DEV: Introduce enabled? API to hashtag data sources (#22632)
We need a nice way to only return some hashtag data
sources based on various site settings. This commit
adds an enabled? method that every hashtag data source
must implement. If this returns false the data source
will not be used at all for hashtag lookups or search.
2023-07-18 09:39:01 +10:00
Alan Guo Xiang Tan d3a7d335b9
DEV: Bump plugin-api.js to 1.7.0 (#22629)
What does this change do?

This commit removes the experimental label for a bunch of APIs that have
been used in production for quite some time at Discourse so that the
APIs can be released as part of Discourse 3.1
2023-07-18 07:29:55 +08:00
dependabot[bot] e30b7776e7
Build(deps-dev): Bump terser from 5.19.0 to 5.19.1 in /app/assets/javascripts (#22649)
Bumps [terser](https://github.com/terser/terser) from 5.19.0 to 5.19.1.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.19.0...v5.19.1)

---
updated-dependencies:
- dependency-name: terser
  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-07-18 06:32:09 +08:00
Roman Rizzi 77e5153350
UX: Point that topic summaries are generated by an AI (#22646) 2023-07-17 17:24:41 -03:00