mirror of
https://github.com/discourse/discourse.git
synced 2025-02-18 17:25:15 +00:00
REFACTOR: Remove Discourse.Topic
constant
This commit is contained in:
parent
9d457fa51f
commit
d74546f50e
@ -5,6 +5,7 @@ import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import Topic from "discourse/models/topic";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@ -37,10 +38,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
username: this.new_user
|
||||
};
|
||||
|
||||
Discourse.Topic.changeOwners(
|
||||
this.get("topicController.model.id"),
|
||||
options
|
||||
).then(
|
||||
Topic.changeOwners(this.get("topicController.model.id"), options).then(
|
||||
() => {
|
||||
this.send("closeModal");
|
||||
this.topicController.send("deselectAll");
|
||||
|
@ -758,8 +758,8 @@ export default Controller.extend({
|
||||
@method open
|
||||
@param {Object} opts Options for creating a post
|
||||
@param {String} opts.action The action we're performing: edit, reply or createTopic
|
||||
@param {Discourse.Post} [opts.post] The post we're replying to
|
||||
@param {Discourse.Topic} [opts.topic] The topic we're replying to
|
||||
@param {Post} [opts.post] The post we're replying to
|
||||
@param {Topic} [opts.topic] The topic we're replying to
|
||||
@param {String} [opts.quote] If we're opening a reply from a quote, the quote we're making
|
||||
**/
|
||||
open(opts) {
|
||||
|
@ -8,6 +8,7 @@ import showModal from "discourse/lib/show-modal";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import TopicList from "discourse/models/topic-list";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
const controllerOpts = {
|
||||
discovery: inject(),
|
||||
@ -83,7 +84,7 @@ const controllerOpts = {
|
||||
|
||||
resetNew() {
|
||||
this.topicTrackingState.resetNew();
|
||||
Discourse.Topic.resetNew().then(() => this.send("refresh"));
|
||||
Topic.resetNew().then(() => this.send("refresh"));
|
||||
},
|
||||
|
||||
dismissReadPosts() {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { empty, alias } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
const _buttons = [];
|
||||
|
||||
@ -88,7 +89,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
this.set("loading", true);
|
||||
|
||||
const topics = this.get("model.topics");
|
||||
return Discourse.Topic.bulkOperation(topics, operation)
|
||||
return Topic.bulkOperation(topics, operation)
|
||||
.then(result => {
|
||||
this.set("loading", false);
|
||||
if (result && result.topic_ids) {
|
||||
|
@ -2,6 +2,7 @@ import { alias } from "@ember/object/computed";
|
||||
import { NotificationLevels } from "discourse/lib/notification-levels";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
export default Mixin.create({
|
||||
bulkSelectEnabled: false,
|
||||
@ -33,9 +34,9 @@ export default Mixin.create({
|
||||
|
||||
let promise;
|
||||
if (this.selected.length > 0) {
|
||||
promise = Discourse.Topic.bulkOperation(this.selected, operation);
|
||||
promise = Topic.bulkOperation(this.selected, operation);
|
||||
} else {
|
||||
promise = Discourse.Topic.bulkOperationByFilter(
|
||||
promise = Topic.bulkOperationByFilter(
|
||||
"unread",
|
||||
operation,
|
||||
this.get("category.id"),
|
||||
|
@ -1,5 +1,6 @@
|
||||
import PreloadStore from "preload-store";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
const CategoryList = Ember.ArrayProxy.extend({
|
||||
init() {
|
||||
@ -39,7 +40,7 @@ CategoryList.reopenClass({
|
||||
|
||||
if (c.topics) {
|
||||
c.topics = c.topics.map(t => {
|
||||
const topic = Discourse.Topic.create(t);
|
||||
const topic = Topic.create(t);
|
||||
topic.set("category", c);
|
||||
return topic;
|
||||
});
|
||||
|
@ -2,6 +2,7 @@ import { ajax } from "discourse/lib/ajax";
|
||||
import Badge from "discourse/models/badge";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { Promise } from "rsvp";
|
||||
import Topic from "discourse/models/topic";
|
||||
|
||||
const UserBadge = Discourse.Model.extend({
|
||||
@computed
|
||||
@ -35,7 +36,7 @@ UserBadge.reopenClass({
|
||||
}
|
||||
var topics = {};
|
||||
json.topics.forEach(function(topicJson) {
|
||||
topics[topicJson.id] = Discourse.Topic.create(topicJson);
|
||||
topics[topicJson.id] = Topic.create(topicJson);
|
||||
});
|
||||
|
||||
// Create the badges.
|
||||
|
@ -93,7 +93,6 @@ JS
|
||||
"discourse/models/user",
|
||||
"discourse/models/session",
|
||||
"discourse/models/model",
|
||||
"discourse/models/topic",
|
||||
"discourse/models/post",
|
||||
"discourse/views/grouped"]
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user