From 75f46ca63238558730cec51cc2814a1e80644e56 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Wed, 27 May 2020 22:47:46 +0200 Subject: [PATCH] DEV: Fix a deprecated `ember` import (#9903) See the following for `Ember.testing` and `@ember/debug isTesting`: * https://github.com/emberjs/ember.js/blob/8cf29959f76eee822192cb820347113d050b204e/packages/ember/index.js#L372-L376 * https://github.com/emberjs/ember.js/blob/8cf29959f76eee822192cb820347113d050b204e/packages/%40ember/debug/lib/testing.ts --- app/assets/javascripts/discourse-loader.js | 1 + .../javascripts/discourse/app/helpers/page-reloader.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse-loader.js b/app/assets/javascripts/discourse-loader.js index fc829ae12f0..6e36f805b1f 100644 --- a/app/assets/javascripts/discourse-loader.js +++ b/app/assets/javascripts/discourse-loader.js @@ -29,6 +29,7 @@ var define, requirejs; inject: Ember.inject.controller }, "@ember/debug": { + isTesting: () => Ember.testing, warn: Ember.warn }, "@ember/object": { diff --git a/app/assets/javascripts/discourse/app/helpers/page-reloader.js b/app/assets/javascripts/discourse/app/helpers/page-reloader.js index 6429be3a3cc..ad971590cf5 100644 --- a/app/assets/javascripts/discourse/app/helpers/page-reloader.js +++ b/app/assets/javascripts/discourse/app/helpers/page-reloader.js @@ -1,9 +1,9 @@ import EmberObject from "@ember/object"; -import Ember from "ember"; +import { isTesting } from "@ember/debug"; export default EmberObject.create({ - reload: function() { - if (!Ember.testing) { + reload() { + if (!isTesting()) { location.reload(); } }