From 7ba08ab7da24e84d0b8e3bfa27df36ca33cb92f8 Mon Sep 17 00:00:00 2001 From: Roman Rizzi Date: Wed, 6 May 2020 19:06:14 -0300 Subject: [PATCH] FIX: Discourse.Model was removed. Use EmberObject instead (#10) --- assets/javascripts/discourse/helpers/format-unix-date.js.es6 | 3 ++- assets/javascripts/discourse/models/admin-product.js.es6 | 3 ++- assets/javascripts/discourse/models/admin-subscription.js.es6 | 3 ++- assets/javascripts/discourse/models/customer.js.es6 | 3 ++- assets/javascripts/discourse/models/group.js.es6 | 3 ++- assets/javascripts/discourse/models/invoice.js.es6 | 3 ++- assets/javascripts/discourse/models/subscription.js.es6 | 3 ++- test/javascripts/models/plan-test.js.es6 | 2 +- 8 files changed, 15 insertions(+), 8 deletions(-) diff --git a/assets/javascripts/discourse/helpers/format-unix-date.js.es6 b/assets/javascripts/discourse/helpers/format-unix-date.js.es6 index 630b328..05381a1 100644 --- a/assets/javascripts/discourse/helpers/format-unix-date.js.es6 +++ b/assets/javascripts/discourse/helpers/format-unix-date.js.es6 @@ -1,11 +1,12 @@ import { registerUnbound } from "discourse-common/lib/helpers"; import { autoUpdatingRelativeAge } from "discourse/lib/formatter"; +import { htmlSafe } from "@ember/template"; registerUnbound("format-unix-date", function(timestamp) { if (timestamp) { const date = new Date(moment.unix(timestamp).format()); - return new Handlebars.SafeString( + return new htmlSafe( autoUpdatingRelativeAge(date, { format: "medium", title: true, diff --git a/assets/javascripts/discourse/models/admin-product.js.es6 b/assets/javascripts/discourse/models/admin-product.js.es6 index 0c00bba..2ffe3c1 100644 --- a/assets/javascripts/discourse/models/admin-product.js.es6 +++ b/assets/javascripts/discourse/models/admin-product.js.es6 @@ -1,6 +1,7 @@ import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const AdminProduct = Discourse.Model.extend({ +const AdminProduct = EmberObject.extend({ isNew: false, metadata: {}, diff --git a/assets/javascripts/discourse/models/admin-subscription.js.es6 b/assets/javascripts/discourse/models/admin-subscription.js.es6 index 78e6f02..58566be 100644 --- a/assets/javascripts/discourse/models/admin-subscription.js.es6 +++ b/assets/javascripts/discourse/models/admin-subscription.js.es6 @@ -1,7 +1,8 @@ import computed from "ember-addons/ember-computed-decorators"; import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const AdminSubscription = Discourse.Model.extend({ +const AdminSubscription = EmberObject.extend({ @computed("status") canceled(status) { return status === "canceled"; diff --git a/assets/javascripts/discourse/models/customer.js.es6 b/assets/javascripts/discourse/models/customer.js.es6 index b8eb126..d4b67c2 100644 --- a/assets/javascripts/discourse/models/customer.js.es6 +++ b/assets/javascripts/discourse/models/customer.js.es6 @@ -1,6 +1,7 @@ import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const Customer = Discourse.Model.extend({ +const Customer = EmberObject.extend({ save() { const data = { source: this.source diff --git a/assets/javascripts/discourse/models/group.js.es6 b/assets/javascripts/discourse/models/group.js.es6 index b230e16..202b943 100644 --- a/assets/javascripts/discourse/models/group.js.es6 +++ b/assets/javascripts/discourse/models/group.js.es6 @@ -1,6 +1,7 @@ import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const Group = Discourse.Model.extend({}); +const Group = EmberObject.extend({}); Group.reopenClass({ subscriptionGroup: diff --git a/assets/javascripts/discourse/models/invoice.js.es6 b/assets/javascripts/discourse/models/invoice.js.es6 index 5b1a97f..8bbb88d 100644 --- a/assets/javascripts/discourse/models/invoice.js.es6 +++ b/assets/javascripts/discourse/models/invoice.js.es6 @@ -1,6 +1,7 @@ import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const Invoice = Discourse.Model.extend({}); +const Invoice = EmberObject.extend({}); Invoice.reopenClass({ findAll() { diff --git a/assets/javascripts/discourse/models/subscription.js.es6 b/assets/javascripts/discourse/models/subscription.js.es6 index 9b91645..c279be1 100644 --- a/assets/javascripts/discourse/models/subscription.js.es6 +++ b/assets/javascripts/discourse/models/subscription.js.es6 @@ -1,7 +1,8 @@ import computed from "ember-addons/ember-computed-decorators"; import { ajax } from "discourse/lib/ajax"; +import EmberObject from "@ember/object"; -const Subscription = Discourse.Model.extend({ +const Subscription = EmberObject.extend({ @computed("status") canceled(status) { return status === "canceled"; diff --git a/test/javascripts/models/plan-test.js.es6 b/test/javascripts/models/plan-test.js.es6 index 52b99a9..c17c6cb 100644 --- a/test/javascripts/models/plan-test.js.es6 +++ b/test/javascripts/models/plan-test.js.es6 @@ -11,7 +11,7 @@ QUnit.test("subscriptionRate", assert => { assert.equal( plan.get("subscriptionRate"), - "$23.99 AUD / month", + "23.99 AUD / month", "it returns the formatted subscription rate" ); });