discourse/app/assets/javascripts
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
..
admin DEV: invert admin/wizard build logic (#22520) 2023-07-10 22:07:21 +01:00
bootstrap-json DEV: Clean up package.json files (#22349) 2023-06-30 13:01:45 +02:00
confirm-new-email DEV: Add error message styling (#21225) 2023-04-25 08:40:18 -04:00
dialog-holder FIX: Ensure dialogs are still rendered if triggered during boot (#22511) 2023-07-10 11:29:04 +01:00
discourse DEV: Make capabilities available outside of application instance (#22516) 2023-07-12 09:38:25 +01:00
discourse-common DEV: Move avatar-utils into dedicated discourse-common module (#22517) 2023-07-12 09:06:16 +01:00
discourse-hbr Build(deps-dev): Bump @babel/core from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22482) 2023-07-07 06:55:10 +08:00
discourse-plugins Build(deps-dev): Bump @babel/core from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22482) 2023-07-07 06:55:10 +08:00
discourse-widget-hbs Build(deps-dev): Bump @babel/core from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22482) 2023-07-07 06:55:10 +08:00
docs
ember-addons
ember-cli-progress-ci
ember-production-deprecations DEV: Clean up package.json files (#22349) 2023-06-30 13:01:45 +02:00
locales UX/DEV: Review queue redesign fixes (#20239) 2023-03-02 16:40:53 +01:00
patches DEV: Update ember-cli to 5.0.0 (#22280) 2023-06-26 17:15:59 +02:00
pretty-text DEV: invert pretty-text build logic (#22524) 2023-07-10 23:11:49 +01:00
select-kit DEV: makes chat modals use the new <DModal /> component (#22495) 2023-07-10 13:43:33 +02:00
truth-helpers Build(deps-dev): Bump @babel/core from 7.22.6 to 7.22.8 in /app/assets/javascripts (#22482) 2023-07-07 06:55:10 +08:00
wizard DEV: invert admin/wizard build logic (#22520) 2023-07-10 22:07:21 +01:00
.licensee.json DEV: Update sub-dependencies (#22325) 2023-06-29 17:08:33 +02:00
.npmrc
discourse-js-processor.js DEV: Update ember-cli-htmlbars to 6.2.0 (#20467) 2023-02-27 18:43:28 +01:00
handlebars-shim.js
package.json Build(deps-dev): Bump patch-package from 7.0.0 to 7.0.1 in /app/assets/javascripts (#22557) 2023-07-12 07:40:02 +08:00
polyfills.js Drop support for iOS < 15.7 (#19847) 2023-01-16 17:28:59 +00:00
service-worker.js.erb FIX: Attempt to reconnect to server when browser visibilty changes (#22259) 2023-06-23 11:32:34 -05:00
yarn.lock Build(deps-dev): Bump patch-package from 7.0.0 to 7.0.1 in /app/assets/javascripts (#22557) 2023-07-12 07:40:02 +08:00