From 6ac1480ffc468c0d83539f98939f52f371464439 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 1 Jul 2019 15:53:58 +0100 Subject: [PATCH] Removed and disabled use of Ember.js function prototype extensions no issue - Function prototype extensions are being deprecated in Ember 3.11 --- ghost/admin/app/components/gh-canvas-header.js | 4 ---- ghost/admin/app/mixins/validation-state.js | 5 +++-- ghost/admin/app/models/post.js | 5 +++-- ghost/admin/config/environment.js | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/ghost/admin/app/components/gh-canvas-header.js b/ghost/admin/app/components/gh-canvas-header.js index 8450961050..0f3dd4034a 100644 --- a/ghost/admin/app/components/gh-canvas-header.js +++ b/ghost/admin/app/components/gh-canvas-header.js @@ -4,10 +4,6 @@ import {run} from '@ember/runloop'; export default Component.extend({ tagName: '', - init() { - this._super(...arguments); - }, - actions: { initScrollWatch(element) { this._onScroll = run.bind(this, this.onScroll, element); diff --git a/ghost/admin/app/mixins/validation-state.js b/ghost/admin/app/mixins/validation-state.js index 574ca173ad..eac1597df4 100644 --- a/ghost/admin/app/mixins/validation-state.js +++ b/ghost/admin/app/mixins/validation-state.js @@ -2,6 +2,7 @@ import Mixin from '@ember/object/mixin'; import {A as emberA} from '@ember/array'; import {isEmpty} from '@ember/utils'; import {observer} from '@ember/object'; +import {on} from '@ember/object/evented'; import {run} from '@ember/runloop'; export default Mixin.create({ @@ -38,9 +39,9 @@ export default Mixin.create({ }, // eslint-disable-next-line ghost/ember/no-observers - hasErrorObserver: observer('errors.[]', 'property', 'hasValidated.[]', function () { + hasErrorObserver: on('init', observer('errors.[]', 'property', 'hasValidated.[]', function () { run.once(this, 'setHasError'); // this.setHasError(); - }).on('init') + })) }); diff --git a/ghost/admin/app/models/post.js b/ghost/admin/app/models/post.js index 72273826d9..de8e6a748f 100644 --- a/ghost/admin/app/models/post.js +++ b/ghost/admin/app/models/post.js @@ -9,6 +9,7 @@ import {compare} from '@ember/utils'; import {computed, observer} from '@ember/object'; import {equal, filterBy} from '@ember/object/computed'; import {isBlank} from '@ember/utils'; +import {on} from '@ember/object/evented'; import {inject as service} from '@ember/service'; // ember-cli-shims doesn't export these so we must get them manually @@ -228,10 +229,10 @@ export default Model.extend(Comparable, ValidationEngine, { // TODO: is there a better way to handle this? // eslint-disable-next-line ghost/ember/no-observers - _setPublishedAtBlogTZ: observer('publishedAtUTC', 'settings.activeTimezone', function () { + _setPublishedAtBlogTZ: on('init', observer('publishedAtUTC', 'settings.activeTimezone', function () { let publishedAtUTC = this.publishedAtUTC; this._setPublishedAtBlogStrings(publishedAtUTC); - }).on('init'), + })), _setPublishedAtBlogStrings(momentDate) { if (momentDate) { diff --git a/ghost/admin/config/environment.js b/ghost/admin/config/environment.js index e0b64fbdbf..4214fbce55 100644 --- a/ghost/admin/config/environment.js +++ b/ghost/admin/config/environment.js @@ -17,7 +17,7 @@ module.exports = function (environment) { Date: false, Array: true, String: true, - Function: true + Function: false } },