Commit Graph

17285 Commits

Author SHA1 Message Date
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
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
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
Isaac Janzen
bdaecc90c4
DEV: Convert group-default-notifications modal to component-based API (#22521)
This PR converts the `group-default-notifications` modal to make use of the new component-based API
2023-07-17 15:06:30 -05:00
Isaac Janzen
80a1709965
DEV: Convert history modal to component-based API (#22522)
This PR converts the `history` modal to make use of the new component-based API
2023-07-17 13:16:40 -05:00
Joffrey JAFFEUX
e214fc38ed
FIX: in modal should check for body (#22642)
To decide to use flip behavior select-kit will check if it's located inside a modal as a modal will scroll if overflown, however, when locating the select-kit element in the footer or header this is not the case. This commit will deactivate `flip` modifier only when used inside modal body.
2023-07-17 17:39:01 +02:00
David Battersby
d44c9cf065
FIX: bind selector to event listener callback for lightbox (#22637)
Fixes an issue where this.selector value was not binded at the time of adding the event listener. Therefore when someone opens a chat channel that has images, the value of selector would change. I also moved the callback to a named function (rather than the default handleEvent).
2023-07-17 19:55:48 +08:00
Joffrey JAFFEUX
a610c86302
DEV: adds touchMove support for widgets (#22635)
No tests as widgets are in maintenance mode until we can remove it, and this is also hard to test.
2023-07-17 12:49:00 +02:00
dependabot[bot]
edc837eaf5
Build(deps-dev): Bump babel-import-util from 1.3.0 to 1.4.1 in /app/assets/javascripts (#22626)
Bumps [babel-import-util](https://github.com/ef4/babel-import-util) from 1.3.0 to 1.4.1.
- [Commits](https://github.com/ef4/babel-import-util/compare/v1.3.0...v1.4.1)

---
updated-dependencies:
- dependency-name: babel-import-util
  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-07-17 08:58:46 +08:00
dependabot[bot]
9d8927c4f9
Build(deps-dev): Bump eslint from 8.44.0 to 8.45.0 in /app/assets/javascripts (#22625)
Bumps [eslint](https://github.com/eslint/eslint) from 8.44.0 to 8.45.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.44.0...v8.45.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-07-17 08:58:32 +08:00
Martin Brennan
6459922993
DEV: Move Bookmark modal/component to use d-modal (#22532)
c.f. https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057

This also converts the Bookmark component to a Glimmer
component.
2023-07-17 10:14:17 +10:00
Roman Rizzi
0a65b9f098
UX: Disable summarize button while generating summary (#22618) 2023-07-14 12:19:51 -03:00
marstall
3e6e33df35
redirect to /login after account delete to prevent recreation of sso account (#22575)
* redirect to /login after account delete to prevent recreation of sso account

* after delete, redirect to /login if siteSettings.login_required
2023-07-14 11:13:45 -04:00
David Battersby
ad365fad7a
FIX: lightbox setup blocked due to waiting for first image load (#22612)
The Problem
Clicking on a large image opens lightbox, however the new lightbox currently waits for the first image to finish loading before it finishes loading the lightbox UI correctly (ie. background color). This makes the visual experience feel broken.

Because open() is waiting for the image to load, it doesn't trigger the onOpen callback, which appends a .has-lightbox class to the html tag. The lightbox background color requires that css class to be set for the styles to be applied correctly.

The Solution
This PR prevents blocking when loading loading the first image (image that was clicked) within the lightbox, and therefore allows the css class to be appended to the html tag correctly and as a result fixing the styling issues.

The #setCurrentItem  function is async and awaits the loading of preloadItemImages already, so the image will load correctly when complete despite the rest of the UI loading in advance.
2023-07-14 14:02:06 +08:00
Faizaan Gagan
24ab2f42b0
FIX: add the required widget for admin-problems notification item (#22602) 2023-07-14 10:37:01 +05:30
Roman Rizzi
dc547e39aa
FEATURE: Let users collapse the topic inline summary (#22604) 2023-07-13 18:21:50 -03:00
Godfrey Chan
4d62c49e20
DEV: move raw handlebars to /raw-templates/ (#22574)
The primary motivation is to simplify `eagerLoadRawTemplateModules` which curently introspects the module dependencies (the `imports` at runtime). This is no longer supported in Embroider as the AMD shims do not have any dependencies (since it's managed internally with webpack).
2023-07-13 12:57:45 -05:00
Joffrey JAFFEUX
ee3bdab61d
FIX: ensures lightbox sends valid color to react-native (#22598)
Prior to this commit the `setSiteThemeColor` could mistakenly receive a color with a leading `#` which would cause an invalid color to be send to `postRNWebviewMessage` and would eventually cause a crash if we try to interpolate between this color and another.
2023-07-13 18:37:52 +02:00
David Taylor
30c152c5a7
FIX: Only use lastViewedTopic when going 'back' to a topic list (#22594)
Using the lastViewedTopicId indiscriminately can cause strange scrolling behavior when navigating to a **different** topic list after viewing a topic. We only want to refocus the topic when going 'back' to the same topic list which originally triggered the navigation.
2023-07-13 15:23:36 +01:00
David Taylor
9c915345ea
DEV: Simplify qunit target selection (#22591)
Previously we had three query parameters to control which tests would be run. The default was to run all core/plugin tests together, which would almost always lead to errors and does not match the way we run tests in CI.

This commit removes the three old parameters (skip_core, skip_plugins and single_plugin), and introduces a new 'target' parameter. This can have a value of 'core', 'plugins', 'all', or a specific plugin name. The default is 'core'. Attempting to use the old parameters will raise an error.
2023-07-13 14:20:00 +01:00
David Taylor
dfe94ba118
DEV: Move all scroll position reset/remember logic to a shared service (#22552)
Previously we were implementing scroll reset/memorization on a per-page basis. Many of these approaches relied on the `didInsertElement` hook, which is no longer appropriate since Discourse changed to use the 'loading slider' strategy for page transitions.

This commit rips out all of our custom scroll resetting/memorizing, and implements those things in a generic service. There are two features:

1. After every route transition, scroll to the top of the page
2. When using browser back/forward buttons, restore the last known scroll position for those routes

To opt-out of the behaviour, individual routes can add a scrollOnTransition boolean to their RouteInfo metadata using Ember's `buildRouteInfoMetadata` hook.
2023-07-13 13:40:08 +01:00
David Battersby
80578e75f0
FIX: add tracked property for items in lightbox carousel (#22592)
The new lightbox was missing the tracked property for items when it was launched earlier as experimental feature flag.

This PR should fix issues experienced when the user clicks between multiple galleries causing the carousel images not to be updated as they were previously not tracked.
2023-07-13 20:36:22 +08:00
David Taylor
a87841067b
DEV: Improve ember-cli 'LOAD_PLUGINS' behavior (#22590)
Our ember-cli config now follows the same behavior as Discourse core. LOAD_PLUGINS=0 will prevent any plugin assets from being compiled/served.
2023-07-13 11:27:29 +01:00
dependabot[bot]
0d5ee99bd5
Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22578)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.8 to 7.22.9.
- [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.9/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-07-13 12:11:54 +02:00
Alan Guo Xiang Tan
48c8ed49d6
FIX: Dismissing unread posts did not publish changes to other clients (#22584)
Why this change?

Prior to this change, dismissing unreads posts did not publish the
changes across clients for the same user. As a result, users can end up
seeing an unread count being present but saw no topics being loaded when
visiting the `/unread` route.
2023-07-13 18:05:56 +08:00
dependabot[bot]
de9277446f
Build(deps-dev): Bump patch-package in /app/assets/javascripts (#22577)
Bumps [patch-package](https://github.com/ds300/patch-package) from 7.0.1 to 7.0.2.
- [Release notes](https://github.com/ds300/patch-package/releases)
- [Changelog](https://github.com/ds300/patch-package/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ds300/patch-package/commits)

---
updated-dependencies:
- dependency-name: patch-package
  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-13 11:10:33 +02:00
dependabot[bot]
57034953f1
Build(deps-dev): Bump @babel/standalone in /app/assets/javascripts (#22579)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.22.8 to 7.22.9.
- [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.9/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  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-13 11:10:00 +02:00
Joe
82c03127df
FEATURE: New Discourse Lightbox using Glimmer (#19798)
Introduces new lightbox as a step to migrate away from Magnific Popup.

Please see https://meta.discourse.org/t/migrating-away-from-magnific-popup/251505 for more details

Co-authored-by: Nat <natalie.tay@discourse.org>
Co-authored-by: David Battersby <info@davidbattersby.com>
2023-07-13 15:06:17 +08:00
Alan Guo Xiang Tan
4d5f9b8a21
UX: Move group mentions notifications into the reply tab (#22562)
Why this change?

Group mention notifications are currently placed in the "Others" tab
of the user menu which is odd considering that mentioned notifications
are in the reply tab. This commit changes it such that group mention
notifications are displayed in the reply tab as well.
2023-07-13 06:52:03 +08:00
Roman Rizzi
6892324767
FIX: Display the whole summary when it consists of multiple <p> tags. (#22568) 2023-07-12 13:48:29 -03:00
Roman Rizzi
61aeb2da90
FEATURE: Inline topic summary. Cached version accessible to everyone. (#22551)
* FEATURE:  Inline topic summary. Cached version accessible to everyone.

Anons and non-members of the `custom_summarization_allowed_groups_map` groups can see cached summaries for any accessible topic. After the first 12 hours and if the posts to summarize have changed, allowed users clicking on the button will automatically re-generate it.

* Ensure chat summaries work and prevent model hallucinations when there are no messages.
2023-07-12 11:21:51 -03:00
David Taylor
a68448d5cf
DEV: Automatically re-render widget when arguments change (#22548)
In the past, widget implementors would have to subclass the MountWidget component and wire up `didUpdateAttrs` or an observer to trigger a re-render. If that wasn't done, then it could lead to weird behaviors, especially now that page transitions in Discourse do not de-render/re-render components by default.

This commit updates MountWidget so that it re-renders whenever any input arguments change.
2023-07-12 10:22:42 +01:00
David Taylor
fb9948c79c
DEV: Make capabilities available outside of application instance (#22516)
Browser capabilities are inherently unconnected to the lifecycle of our app. Making them formally available outside of the service means that they can safely be used in non-app-linked functions without needing risky hacks like `helperContext()` or `discourse-common/lib/get-owner`.

One example of where the old hacks were problematic is the `translateModKey()` utility function. This is called in the root of the `discourse/components/modal/keyboard-shortcuts-help` es6 module. If anything (e.g. a theme/plugin) caused that es6 module to be `require()`d before the application was booted, a fatal error would occur.

Following this commit, `translateModKey()` can safely import and access `capabilities` without needing to worry about the app lifecycle.

The only potential downside to this approach is that the capabilities data now persists across tests. If any tests need to 'stub' capabilities, they will need to revert their changes at the end of the test (e.g. by using Sinon to stub a property).

This commit also updates some legacy references from `capabilities:main` to `service:capabilities`.
2023-07-12 09:38:25 +01:00
David Taylor
2fde58def4
DEV: Move avatar-utils into dedicated discourse-common module (#22517)
These avatar-related helper functions are used in pretty-text, which currently means we load the entire `discourse/lib/utilities` module into the mini-racer when running pretty-text on the server side. This stops us adding any logic or imports to discourse/lib/utilities which may depend on other `discourse/` namespace features.

This commit moves the avatar-related utils into a dedicated module in the `discourse-common` namespace, adds backwards-compatibility shims, and updates the pretty-text config accordingly.
2023-07-12 09:06:16 +01:00
dependabot[bot]
df579ab708
Build(deps-dev): Bump patch-package from 7.0.0 to 7.0.1 in /app/assets/javascripts (#22557)
Bumps [patch-package](https://github.com/ds300/patch-package) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/ds300/patch-package/releases)
- [Changelog](https://github.com/ds300/patch-package/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ds300/patch-package/commits)

---
updated-dependencies:
- dependency-name: patch-package
  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-12 07:40:02 +08:00
dependabot[bot]
d477f8aaad
Build(deps-dev): Bump terser from 5.18.2 to 5.19.0 in /app/assets/javascripts (#22558)
Bumps [terser](https://github.com/terser/terser) from 5.18.2 to 5.19.0.
- [Changelog](https://github.com/terser/terser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/terser/terser/compare/v5.18.2...v5.19.0)

---
updated-dependencies:
- dependency-name: terser
  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-07-12 07:37:34 +08:00
Godfrey Chan
cfa2f1fea8
DEV: Refactor deprecation silencer (#22526)
- Unify the silencing methods, use a WeakMap to remember the seen objects
- Export a proper plugin and use the absolute path in the config, instead
  of the proprietary config from `broccoli-babel-transpiler`

The latter causes problems in Embroider which doesn't use the broccoli
based babel pipeline.
2023-07-11 17:01:51 +01:00
Bianca Nenciu
bdb9ee8507
UX: Improve user tips (#22518)
- Add an icon to the bootstrap user tip to draw attention
- Remove the second "don't show user tip" button from every user tip
2023-07-11 18:22:40 +03:00
David Taylor
5a30583174
DEV: Add backwards-compatibility following i18n export change (#22540)
Some themes were doing `require("i18n").t()`, which was never recommended, but did work prior to f8483295. This commit restores that functionality with a deprecation notice.
2023-07-11 16:15:30 +01:00
Selase Krakani
69e0c23f41
FIX: Conditionally hide Add Alternate Email button based on site setting (#22525)
Hide button in UI if `max_allowed_secondary_emails` site setting is 0.
2023-07-11 12:17:40 +00:00
dependabot[bot]
3136f6766b
Build(deps): Bump semver from 5.7.1 to 5.7.2 in /app/assets/javascripts (#22530)
Bumps [semver](https://github.com/npm/node-semver) from 5.7.1 to 5.7.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v5.7.2/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v5.7.1...v5.7.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 13:49:27 +08:00
Alan Guo Xiang Tan
91588cf938
DEV: Improve composer-messages implementation for PMs (#22529)
What does this commit do??

This commit introduces two changes:

1. As a follow up review comment to
   cc463c3e9b, we remove the top level
recipientNames cache in composer message to be a property of the
`ComposerMessage` component instead. Across components, we're more
likely to get a cache miss than a hit since we're caching the entire
recipient array so we can just drop it. If we really need this
optimisation, we should probably use a map and cache the information for
each user instead. However, the request is fairly cheap so we avoid that
optimisation for now.

2. This commit adds a debounce to `_typeReply` as well since we were not
   debouncing and the method was being called each time we received the
event.
2023-07-11 10:49:27 +08:00
Alan Guo Xiang Tan
ab053ac669
UX: Remove section heading for community section (#22405)
Why is this change being made?

We've decided that the previous "community" section should look more
like a primary section that holds the most important navigation links
for the site and the word "community" doesn't quite fit that
description. Therefore, we've made the decision to drop the
section heading for the community section. 

As part of removing the section heading, the following changes are made
as well:

1. Button to customize the section has been moved to the "footer" of the
   "More..." section when `navigation_menu` site setting is set to `sidebar`. 
   When `navigation_menu` is set to `header dropdown`, a button to customize 
   the section is shown inline.

2. The section will no longer be collapsable.

3. The title of the section is no longer customisable as it is no longer
   displayed. As a technical note, we have not dropped any previous
   customisations of the section's title previously in case we have to
   bring back the header in the future.

4. The new topic button that was previously present in the header has
   been removed alongside the header. Admins can add a custom section
   link to the `/new-topic` route if there would like to make it easier for
   users to create a new topic in the sidebar.
2023-07-11 09:40:37 +08:00
Alan Guo Xiang Tan
cc463c3e9b
DEV: Fix flaky QUnit tests (#22528)
Why this change?

QUnit tests that involves composer messages for user not seen was flaky
because we were caching the recipient names but not clearing them after
the component has been destroyed.

See
https://github.com/discourse/discourse/actions/runs/5513506446/jobs/10051731946
as an example of failure.
2023-07-11 09:15:09 +08:00
Godfrey Chan
3140a4b2ce
DEV: invert pretty-text build logic (#22524)
Generally follows the same pattern as #22520

There are some changes here, notably it uses the addon's babel
settings rather than the app's, and it goes through the same
treatment as the rest of the addon code (which may include more
than just babel).

However, this probably brings us closer to the normal expectations
you have around developing addon code, and in any case, does not
seem to have any effect on the final output:

```
$ diff dist/assets/markdown-it-bundle.js /tmp/dist-before/assets/markdown-it-bundle.js
```
2023-07-10 23:11:49 +01:00
Kris
7d5db385d6
DEV: Remove header floats and clearfixes (#22523) 2023-07-10 17:57:20 -04:00
Sérgio Saquetim
657c1023fd
FIX: Default parameter recipients to create new message via params must be a string (#22455)
* FIX: Default parameter recipients to create new message via params must be a string

The default parameter recipients was defined as an empty array in:
- route:application#createNewMessageViaParams
- mixin:open-composer#openComposerWithMessageParams

However, in model:composer, targetRecipient is handled as a string as can be
verified due to the existence of the #targetRecipientsArray computed property.

Using the default parameter defined as an array was causing issues with
the `discourse-bcc` plugin when opening the composer using the route
/new-message.

* DEV: Added tests for the composer messages for private messages

* Fix test naming

Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>

---------

Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2023-07-10 18:33:58 -03:00
Godfrey Chan
3d7cca5911
DEV: invert admin/wizard build logic (#22520)
Currently, the admin/wizard build relies on the addon build getting
triggered first, so that its `treeForAddon()` hook will be called,
and then it can stash the result on the app's options, which is
super fragile. In Embroider the timing works differently so the
trees end up being `undefined`.

This inverts the logic so that it will be discourse core's build
calling these hooks at a specific timing and return the result
rather than coordinating through the options bag.

```
$ diff dist/assets/admin.js dist-after/assets/admin.js
$ diff dist/assets/wizard.js dist-after/assets/wizard.js
```
2023-07-10 22:07:21 +01:00
Godfrey Chan
f84832957d
DEV: use explicit default export in I18n shim (#22519)
Currently the I18n module shim return an object. Per AMD/loader.js,
the properties on the object becomes named exports of the module,
i.e. `import { t } from 'I18n';`.

However, this is not how we actually consume this module. We always
do `import I18n from 'I18n';`.

The returned object from the shim (`window.I18n`) does NOT have a
`default` property on it. This is only working because loader.js
has a `makeDefaultExport` feature that defaults to true, which we
are relying on to synthesize the default export for us.

That feature has been noted as undesirable and may some day be
deprecated. In Embroider, it specifically disables the feature in
loader.js.

https://github.com/embroider-build/embroider/issues/539
2023-07-10 22:06:18 +01:00
Isaac Janzen
049c4b606a
FIX: Update remaining backup code count after creation (#22475) 2023-07-10 13:37:14 -05:00
Bianca Nenciu
0b16fc8172
FEATURE: Show tooltip for bootstrap mode (#22257)
Improve user tips UX and make them smoother.
2023-07-10 20:42:09 +03:00
Kris
26d19fc1bd
UX: indicate main sidebar section is always public (#22492) 2023-07-10 11:44:40 -04:00
Joffrey JAFFEUX
9830c40386
DEV: makes chat modals use the new <DModal /> component (#22495)
This commit also standardize the naming pattern of modals: `<Chat::Modal::FooBar />` and changes css class accordingly.

Co-authored-by: David Taylor <david@taylorhq.com>
2023-07-10 13:43:33 +02:00
David Taylor
ed2dae6d1a
FIX: Ensure dialogs are still rendered if triggered during boot (#22511)
When the loading slider is enabled, the rendering of `application.hbs` is slightly delayed compared to the old 'spinner' strategy. This means that if a route tried to render a dialog during its `model()` hook, the dialog wrapper element would not be present and an error would occur.

This commit detects that situation and delays rendering the error until the next runloop iteration. If the element is still not found, we print a useful error to the console.

In the long term, we should ideally convert the dialog service to use a pure-ember rendering strategy instead of leaning on a11y-dialog. But for now, this workaround should resolve the problems identified by the chat system specs.
2023-07-10 11:29:04 +01:00
David Taylor
9a1a3906c4
DEV: Support rendering <DModal> as a <form> element (#22507) 2023-07-10 10:28:45 +01:00
Ted Johansson
9915236e42
FEATURE: Warn about outdated translation overrides in admin dashboard (#22384)
This PR adds a feature to help admins stay up-to-date with their translations. We already have protections preventing admins from problems when they update their overrides. This change adds some protection in the other direction (where translations change in core due to an upgrade) by creating a notice for admins when defaults have changed.

Terms:

- In the case where Discourse core changes the default translation, the translation override is considered "outdated".
- In the case above where interpolation keys were changed from the ones the override is using, it is considered "invalid".
- If none of the above applies, the override is considered "up to date".

How does it work?

There are a few pieces that makes this work:

- When an admin creates or updates a translation override, we store the original translation at the time of write. (This is used to detect changes later on.)
- There is a background job that runs once every day and checks for outdated and invalid overrides, and marks them as such.
- When there are any outdated or invalid overrides, a notice is shown in admin dashboard with a link to the text customization page.

Known limitations

The link from the dashboard links to the default locale text customization page. Given there might be invalid overrides in multiple languages, I'm not sure what we could do here. Consideration for future improvement.
2023-07-10 10:06:40 +08:00
Martin Brennan
ba53df5254
FIX: Show preview of Arial/System font in wizard (#22486)
Followup to db80a8ce79

The previous commit broke previewing the Arial and System fonts (which do
not have variant URLs to load).
2023-07-07 15:28:40 +10:00
Osama Sayegh
d2d6d727de
FEATURE: Add default site settings to control the defaults of navigation menu preferences (#22485)
Follow-up to b27e12445d

This commit adds 2 new site settings `default_sidebar_link_to_filtered_list` and `default_sidebar_show_count_of_new_items` to control the default values for the navigation menu preferences that were added in the linked commit (`sidebar_link_to_filtered_list` and `sidebar_show_count_of_new_items` respectively).
2023-07-07 04:52:10 +03:00
Alan Guo Xiang Tan
bf582290ba
FIX: Can't dismiss new topics for experimental new new view (#22484)
Regressed in 8b80132f88 due to a lack of
tests.
2023-07-07 08:28:27 +08:00
dependabot[bot]
67c7b1cc46
Build(deps-dev): Bump @babel/standalone from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22479)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.22.6 to 7.22.8.
- [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.8/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  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-07 07:09:37 +08:00
dependabot[bot]
271e60e8c4
Build(deps-dev): Bump @babel/core from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22482)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.6 to 7.22.8.
- [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.8/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-07-07 06:55:10 +08:00
Kris
98afea4748
UX: adjust sidebar modal styles, consolidate css (#22444)
This gets all the related CSS into the common file, and removes desktop and mobile variants.

This also makes some general styling adjustments.
2023-07-07 06:54:47 +08:00
Joffrey JAFFEUX
f0d82de5d9
DEV: fix flakeyness with drawer specs (#22476)
Chat drawer was using the `DiscourseURL` hook `afterRouteComplete`. This hook suffer from a very poor implementation which makes it very unreliable:

```javascript
if (typeof opts.afterRouteComplete === "function") {
  schedule("afterRender", opts.afterRouteComplete);
}
```

This commit attempts to return the promise from `handleURL` to directly use it and have a very reliable after transition hook.
2023-07-07 00:46:04 +02:00
Isaac Janzen
a9040be47c
FIX: Don't redirect when manually adding 2fa (#22474)
<img width="369" alt="Screenshot 2023-07-06 at 3 41 12 PM" src="https://github.com/discourse/discourse/assets/50783505/847d54ed-a62a-4266-b99e-31279f5bf747">

No changes in styling, the adding of classes was to give targets for testing
2023-07-06 16:44:40 -05:00
Isaac Janzen
7df4eab038
DEV: Convert activation modals to new component-based API (#22227)
This PR converts the following modals:
- `activation-edit`
- `activation-resent`
- `not-activated`

to make use of the new component-based API
2023-07-06 12:36:23 -05:00
Isaac Janzen
8b80132f88
DEV: Convert dismiss modals to component-based API (#22262)
This PR converts the following modals:
- `dismiss-new`
- `dismiss-read`
- `dismiss-notification-confirmation`

to make use of the new component-based API

# Additional Changes
## Before
By default we display a warning modal when dismissing a notification however we bypass the warning modal for specific notification types when they are a 'low priority' type of notification (eg. likes). To do this we were overwriting `dismissWarningModal` on a given notification type component

```javascript
dismissWarningModal() {
  return null
}
```

but in the case we wanted to change the text within the modal we were calling `showModal` and then passing in the respective options all over again, putting the logic of rendering the modal in multiple places.

```javascript
dismissWarningModal() {
  const modalController = showModal("dismiss-notification-confirmation");
  modalController.set(
    "confirmationMessage",
    I18n.t("notifications.dismiss_confirmation.body.assigns", {
      count: this._unreadAssignedNotificationsCount,
    })
  );
  return modalController;
}
```
 

## After
I simplified this by adding an extensible `dismissConfirmationText` function that can be updated on a per component basis as that was the only option being overridden. 

eg

```javascript
get dismissConfirmationText() {
  return I18n.t("notifications.dismiss_confirmation.body.bookmarks", {
    count: this.#unreadBookmarkRemindersCount,
});
```

This saves us from importing the entire modal again and keeps the core logic in one place.

Instead of overwriting the `dismissWarningModal` function and returning `null` to bypass the confirmation modal, I added another extension point of `renderDismissConfirmation` (defaults to true) to _toggle_ whether we should display a confirmation when dismissing notifications.

eg

```javascript
get renderDismissConfirmation() {
  return false;
}
```

we utilize this in core for specific _low priority_ notification types. When you need the confirmation modal to be displayed no matter the case you can set `alwaysRenderDismissConfirmation` to `true`

```
get alwaysRenderDismissConfirmation(){
  return true
}
```

This can be useful when you want to render the confirmation modal on a custom notification type that is not deemed as _high priority_, leading to the confirmation modal never being rendered.

You can see this in use in [Discourse Assign](https://github.com/discourse/discourse-assign/pull/481)
2023-07-06 12:14:26 -05:00
Isaac Janzen
c05e54e461
DEV: Convert second-factor-backup-edit modal to component-based API (#22366)
This PR converts the `second-factor-backup-edit` modal to make use of the new component-based API
2023-07-06 11:03:18 -05:00
David Taylor
f92ed88c52
FEATURE: Enable loading slider by default (#22439)
Followup to d51baa3bb3

Also includes: Force full rerender of post-stream widget when switching topics. This ensures that plugin/theme decorators are re-run when we switch between topics with the loading slider enabled.
2023-07-06 17:02:59 +01:00
David Taylor
f0f0c7cd6c
DEV: Simplify 'dismiss' button display logic (#22467)
Previously we were using the `didInsertElement` hook and querying the DOM to check whether the other button was visible. This is problematic from a performance point of view because it forces the browser to render the layout prematurely. It can also lead to subtle bugs based on the current scroll position.

In addition, having this logic on a `didInsertElement` hook makes it totally incompatible with the new 'loading slider' feature (because the component is not re-rendered between different topic lists).

This commit updates the logic to be based simply on the count of topics in the list. If there are fewer than 5 topics, the top button is hidden.
2023-07-06 15:28:45 +01:00
David Taylor
b40347dcac
FIX: Do not attempt to focus topic-list-item after destroy (#22468)
Under certain conditions, this `afterRender` hook can be triggered after the topic-list-item has been removed from the DOM. This is more likely when the 'loading slider' strategy is used on a site.
2023-07-06 15:27:19 +01:00
David Taylor
c6cd3af5b5
DEV: Convert share-topic modal to new component-based API (#22154) 2023-07-06 11:46:20 +01:00
Martin Brennan
1cd512a03a
DEV: Normalize key modifier checks for keyboard shortcuts (#22451)
This introduces a PLATFORM_KEY_MODIFIER const that
can be used both client and server side, to determine
whether we should be using the Meta or Ctrl key based
on whether the user is on Windows/Linux or Mac.
2023-07-06 13:34:24 +10:00
Krzysztof Kotlarek
fee3ebd812
DEV: Switch edit sidebar section modal to component (#22430)
Why this change?

A new component based API for modals was introduced in
b3a23bd9d6. This commit moves the edit
sidebar section modal to the new API.

Reviewer notes
No functionality or visual change is introduced in this PR.
2023-07-06 11:42:25 +10:00
Krzysztof Kotlarek
0744d242c6
FIX: post alerter notification when topic directly watched (#22433)
In previous PR https://github.com/discourse/discourse/pull/22340 bug was introduced. Notifications were blocked when, even if topic was watched directly. New query is taking TopicUser into consideration.

In addition, in user interface, when `watched_precedence_over_muted` is not set, then value from SiteSetting should be displayed.
2023-07-06 11:27:23 +10:00
Jarek Radosz
e72153dd1a
DEV: Remove unused raw-email code (#22364)
This code seems unused, since ~2016?
2023-07-05 18:13:30 +02:00
dependabot[bot]
07bb4453d9
Build(deps-dev): Bump @babel/standalone in /app/assets/javascripts (#22419)
Bumps [@babel/standalone](https://github.com/babel/babel/tree/HEAD/packages/babel-standalone) from 7.22.5 to 7.22.6.
- [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.6/packages/babel-standalone)

---
updated-dependencies:
- dependency-name: "@babel/standalone"
  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-05 17:05:32 +02:00
Isaac Janzen
2a598db08a
DEV: Convert second-factor-add-totp modal to component-based API (#22358)
This PR converts the `second-factor-add-totp` modal to make use of the new component-based API
2023-07-05 09:56:04 -05:00
dependabot[bot]
760668dfde
Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22418)
Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.22.5 to 7.22.6.
- [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.6/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-07-05 16:47:28 +02:00
David Taylor
d51baa3bb3
FEATURE: Introduce 'loading slider' for page navigations (#22042)
This brings the functionality from https://github.com/discourse/discourse-loading-slider into Discourse core. Default behaviour remains the same - the new slider mode can be enabled using the new 'page_loading_indicator' site setting.
2023-07-05 14:59:24 +01:00
Andrei Prigorshnev
a9dfda2d66
DEV: fix flaky specs for user status tooltip (#22435)
A follow-up to 585a2e4e. A couple of tests with the new rich tooltip were flaky. 
We suppose the reason is some problem related to widgets lifecycle. This PR 
doesn't fix the issue, but isolates testing of the tooltip related logic related 
inside its own test, which should make it not flaky.

This is a temporal solution, we're going to move all these code to using 
glimmer components.
2023-07-05 16:46:09 +04:00
Isaac Janzen
239d56dd69
DEV: Convert group-add-members modal to component-based API (#22368) 2023-07-05 11:04:06 +01:00
Keegan George
ad1b466cd4
DEV: Update JSON Editor to Glimmer and use new modalAPI (#22421) 2023-07-05 10:27:29 +01:00
Keegan George
d458ca154c
DEV: Update keyboard shortcuts to glimmer and new modal api (#22422) 2023-07-05 10:13:16 +01:00
Joffrey JAFFEUX
40ec9ab97b
DEV: skip post-inline-mention test (#22417)
Mentions tests are flakey ATM
2023-07-04 23:12:08 +02:00
Isaac Janzen
3f91656c2d
DEV: Convert do-not-disturb modal to component-based API (#22394)
This PR converts the `do-not-disturb` modal to make use of the new component-based API
2023-07-04 15:27:41 -05:00
Isaac Janzen
aaccb774de
DEV: Update default modal alert class (#22416)
This PR changes the default to not append any classes (when `@flashType` isn't present) and instead leans on the `alert` class for styling the alert which is a 1 to 1 match of the `alert-error` class.

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L1-L4)

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L22-L24)

In essence this changes the default modal alert styling from `success` to `error` if not overridden by `@flashType`
2023-07-04 15:22:14 -05:00
Keegan George
904450594d
DEV: Convert form template modals to new component-based API (#22196) 2023-07-04 12:42:36 -07:00
Renato Atilio
ce0ddfba8c
FIX: mobile share canonical URL (#22370)
* FIX: mobile share canonical url

* FIX: test

* DEV: address PR comments
2023-07-04 15:02:52 -03:00
Isaac Janzen
8f21d2cf40
DEV: Convert second-factor-edit modals to component-based API (#22367)
This PR converts the following modals:
- `second-factor-edit-security-key`
- `second-factor-edit`

to make use of the new component-based API
2023-07-04 12:13:54 -05:00
David Taylor
1122454904
DEV: Error if invalid @flashType passed to modal (#22414) 2023-07-04 18:11:29 +01:00
Isaac Janzen
148431d521
DEV: Convert fullscreen modals to component-based API (#22248)
This PR converts the following modals:
- `fullscreen-code`
- `fullscreen-table`

to make use of the new component-based API
2023-07-04 10:35:10 -05:00