mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 16:46:12 +08:00
FIX: defer requires to avoid future dependencies
This commit is contained in:
parent
c0b277d273
commit
0c5d0ddb1b
|
@ -3,7 +3,6 @@ import { queryParams } from 'discourse/controllers/discovery-sortable';
|
||||||
import BulkTopicSelection from 'discourse/mixins/bulk-topic-selection';
|
import BulkTopicSelection from 'discourse/mixins/bulk-topic-selection';
|
||||||
import { endWith } from 'discourse/lib/computed';
|
import { endWith } from 'discourse/lib/computed';
|
||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
import TopicList from 'discourse/models/topic-list';
|
|
||||||
|
|
||||||
const controllerOpts = {
|
const controllerOpts = {
|
||||||
needs: ['discovery'],
|
needs: ['discovery'],
|
||||||
|
@ -55,6 +54,7 @@ const controllerOpts = {
|
||||||
this.set('controllers.discovery.loading', true);
|
this.set('controllers.discovery.loading', true);
|
||||||
|
|
||||||
this.store.findFiltered('topicList', {filter}).then(list => {
|
this.store.findFiltered('topicList', {filter}).then(list => {
|
||||||
|
const TopicList = require('discourse/models/topic-list');
|
||||||
TopicList.hideUniformCategory(list, this.get('category'));
|
TopicList.hideUniformCategory(list, this.get('category'));
|
||||||
|
|
||||||
this.setProperties({ model: list });
|
this.setProperties({ model: list });
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type';
|
import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type';
|
||||||
import AdminUser from 'admin/models/admin-user';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
userDetails: null,
|
userDetails: null,
|
||||||
|
@ -125,6 +124,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
|
|
||||||
fetchUserDetails() {
|
fetchUserDetails() {
|
||||||
if (Discourse.User.currentProp('staff') && this.get('model.username')) {
|
if (Discourse.User.currentProp('staff') && this.get('model.username')) {
|
||||||
|
const AdminUser = require('admin/models/admin-user').default;
|
||||||
AdminUser.find(this.get('model.username').toLowerCase())
|
AdminUser.find(this.get('model.username').toLowerCase())
|
||||||
.then(user => this.set('userDetails', user));
|
.then(user => this.set('userDetails', user));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||||
import Group from 'discourse/models/group';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
loading: false,
|
loading: false,
|
||||||
|
@ -30,6 +29,8 @@ export default Ember.Controller.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
loadMore() {
|
loadMore() {
|
||||||
|
const Group = require('discourse/models/group').default;
|
||||||
|
|
||||||
if (this.get("loading")) { return; }
|
if (this.get("loading")) { return; }
|
||||||
// we've reached the end
|
// we've reached the end
|
||||||
if (this.get("model.members.length") >= this.get("model.user_count")) { return; }
|
if (this.get("model.members.length") >= this.get("model.user_count")) { return; }
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
import Invite from 'discourse/models/invite';
|
|
||||||
import Group from 'discourse/models/group';
|
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, {
|
export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
needs: ['user-invited-show'],
|
needs: ['user-invited-show'],
|
||||||
|
@ -109,6 +107,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
}.property('isPrivateTopic'),
|
}.property('isPrivateTopic'),
|
||||||
|
|
||||||
groupFinder(term) {
|
groupFinder(term) {
|
||||||
|
const Group = require('discourse/models/group').default;
|
||||||
return Group.findAll({search: term, ignore_automatic: true});
|
return Group.findAll({search: term, ignore_automatic: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -149,6 +148,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
createInvite() {
|
createInvite() {
|
||||||
|
const Invite = require('discourse/models/invite').default;
|
||||||
|
|
||||||
if (this.get('disabled')) { return; }
|
if (this.get('disabled')) { return; }
|
||||||
|
|
||||||
const groupNames = this.get('model.groupNames'),
|
const groupNames = this.get('model.groupNames'),
|
||||||
|
@ -171,6 +172,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
||||||
},
|
},
|
||||||
|
|
||||||
generateInvitelink() {
|
generateInvitelink() {
|
||||||
|
const Invite = require('discourse/models/invite').default;
|
||||||
|
|
||||||
if (this.get('disabled')) { return; }
|
if (this.get('disabled')) { return; }
|
||||||
|
|
||||||
const groupNames = this.get('model.groupNames'),
|
const groupNames = this.get('model.groupNames'),
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import Topic from 'discourse/models/topic';
|
|
||||||
import Post from 'discourse/models/post';
|
|
||||||
import Category from 'discourse/models/category';
|
|
||||||
import User from 'discourse/models/user';
|
|
||||||
|
|
||||||
export function translateResults(results, opts) {
|
export function translateResults(results, opts) {
|
||||||
|
|
||||||
|
const User = require('discourse/models/user').default;
|
||||||
|
const Category = require('discourse/models/category').default;
|
||||||
|
const Post = require('discourse/models/post').default;
|
||||||
|
const Topic = require('discourse/models/topic').default;
|
||||||
|
|
||||||
if (!opts) opts = {};
|
if (!opts) opts = {};
|
||||||
|
|
||||||
// Topics might not be included
|
// Topics might not be included
|
||||||
|
|
Loading…
Reference in New Issue
Block a user