mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Revert "topic fixup" (#11223)
The review queue page fails to load with the error: "TypeError: category is null"
This reverts commit 19b7cdd21f
.
This commit is contained in:
parent
89fc11e93b
commit
ffd1b7c234
@ -225,14 +225,8 @@ const Topic = RestModel.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
@discourseComputed("category_id")
|
@discourseComputed("category_id")
|
||||||
category: {
|
category(categoryId) {
|
||||||
get(categoryId) {
|
return Category.findById(categoryId);
|
||||||
return Category.findById(categoryId);
|
|
||||||
},
|
|
||||||
set(category) {
|
|
||||||
this.set("category_id", category.id);
|
|
||||||
return category;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
categoryClass: fmt("category.fullSlug", "category-%@"),
|
categoryClass: fmt("category.fullSlug", "category-%@"),
|
||||||
|
@ -4,7 +4,7 @@ import Category from "discourse/models/category";
|
|||||||
import Topic from "discourse/models/topic";
|
import Topic from "discourse/models/topic";
|
||||||
import User from "discourse/models/user";
|
import User from "discourse/models/user";
|
||||||
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
import { discourseModule } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import createStore from "discourse/tests/helpers/create-store";
|
import EmberObject from "@ember/object";
|
||||||
|
|
||||||
discourseModule("Unit | Model | topic", function () {
|
discourseModule("Unit | Model | topic", function () {
|
||||||
test("defaults", function (assert) {
|
test("defaults", function (assert) {
|
||||||
@ -36,9 +36,7 @@ discourseModule("Unit | Model | topic", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("lastUnreadUrl", function (assert) {
|
test("lastUnreadUrl", function (assert) {
|
||||||
const store = createStore();
|
const category = EmberObject.create({
|
||||||
const category = store.createRecord("category", {
|
|
||||||
id: 1,
|
|
||||||
navigate_to_first_post_after_read: true,
|
navigate_to_first_post_after_read: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -47,9 +45,10 @@ discourseModule("Unit | Model | topic", function () {
|
|||||||
highest_post_number: 10,
|
highest_post_number: 10,
|
||||||
last_read_post_number: 10,
|
last_read_post_number: 10,
|
||||||
slug: "hello",
|
slug: "hello",
|
||||||
category_id: category.id,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
topic.set("category", category);
|
||||||
|
|
||||||
assert.equal(topic.get("lastUnreadUrl"), "/t/hello/101/1");
|
assert.equal(topic.get("lastUnreadUrl"), "/t/hello/101/1");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user