diff --git a/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js b/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js index b863206725a..f52a707c8c7 100644 --- a/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js +++ b/app/assets/javascripts/discourse/app/controllers/topic-bulk-actions.js @@ -241,11 +241,10 @@ export default Controller.extend(ModalFunctionality, { changeCategory() { const categoryId = parseInt(this.newCategoryId, 10) || 0; - const category = Category.findById(categoryId); this.perform({ type: "change_category", category_id: categoryId }).then( (topics) => { - topics.forEach((t) => t.set("category", category)); + topics.forEach((t) => t.set("category_id", categoryId)); (this.refreshClosure || identity)(); this.send("closeModal"); } diff --git a/app/assets/javascripts/discourse/app/models/category-list.js b/app/assets/javascripts/discourse/app/models/category-list.js index ae414a562a3..cf4d89534da 100644 --- a/app/assets/javascripts/discourse/app/models/category-list.js +++ b/app/assets/javascripts/discourse/app/models/category-list.js @@ -43,11 +43,7 @@ CategoryList.reopenClass({ } if (c.topics) { - c.topics = c.topics.map((t) => { - const topic = Topic.create(t); - topic.set("category", c); - return topic; - }); + c.topics = c.topics.map((t) => Topic.create(t)); } switch (statPeriod) { diff --git a/app/assets/javascripts/discourse/app/models/topic-list.js b/app/assets/javascripts/discourse/app/models/topic-list.js index 57ee578f09f..45020da87f7 100644 --- a/app/assets/javascripts/discourse/app/models/topic-list.js +++ b/app/assets/javascripts/discourse/app/models/topic-list.js @@ -5,7 +5,6 @@ import { ajax } from "discourse/lib/ajax"; import RestModel from "discourse/models/rest"; import { getOwner } from "discourse-common/lib/get-owner"; import { Promise } from "rsvp"; -import Category from "discourse/models/category"; import Session from "discourse/models/session"; import { isEmpty } from "@ember/utils"; import User from "discourse/models/user"; @@ -156,12 +155,10 @@ TopicList.reopenClass({ // Stitch together our side loaded data - const categories = Category.list(), - users = extractByKey(result.users, User), - groups = extractByKey(result.primary_groups, EmberObject); + const users = extractByKey(result.users, User); + const groups = extractByKey(result.primary_groups, EmberObject); return result.topic_list[listKey].map((t) => { - t.category = categories.findBy("id", t.category_id); t.posters.forEach((p) => { p.user = users[p.user_id]; p.extraClasses = p.extras;