FIX: Discourse.Model was removed. Use EmberObject instead (#10)

This commit is contained in:
Roman Rizzi 2020-05-06 19:06:14 -03:00 committed by GitHub
parent 3d9fe5fdce
commit 7ba08ab7da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 8 deletions

View File

@ -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,

View File

@ -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: {},

View File

@ -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";

View File

@ -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

View File

@ -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:

View File

@ -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() {

View File

@ -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";

View File

@ -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"
);
});