Commit Graph

17227 Commits

Author SHA1 Message Date
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