FIX: defer requires to avoid future dependencies

This commit is contained in:
Sam 2015-11-21 00:43:41 +11:00
parent c0b277d273
commit 0c5d0ddb1b
5 changed files with 15 additions and 9 deletions

View File

@ -3,7 +3,6 @@ import { queryParams } from 'discourse/controllers/discovery-sortable';
import BulkTopicSelection from 'discourse/mixins/bulk-topic-selection';
import { endWith } from 'discourse/lib/computed';
import showModal from 'discourse/lib/show-modal';
import TopicList from 'discourse/models/topic-list';
const controllerOpts = {
needs: ['discovery'],
@ -55,6 +54,7 @@ const controllerOpts = {
this.set('controllers.discovery.loading', true);
this.store.findFiltered('topicList', {filter}).then(list => {
const TopicList = require('discourse/models/topic-list');
TopicList.hideUniformCategory(list, this.get('category'));
this.setProperties({ model: list });

View File

@ -1,6 +1,5 @@
import ModalFunctionality from 'discourse/mixins/modal-functionality';
import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type';
import AdminUser from 'admin/models/admin-user';
export default Ember.Controller.extend(ModalFunctionality, {
userDetails: null,
@ -125,6 +124,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
fetchUserDetails() {
if (Discourse.User.currentProp('staff') && this.get('model.username')) {
const AdminUser = require('admin/models/admin-user').default;
AdminUser.find(this.get('model.username').toLowerCase())
.then(user => this.set('userDetails', user));
}

View File

@ -1,5 +1,4 @@
import { popupAjaxError } from 'discourse/lib/ajax-error';
import Group from 'discourse/models/group';
export default Ember.Controller.extend({
loading: false,
@ -30,6 +29,8 @@ export default Ember.Controller.extend({
},
loadMore() {
const Group = require('discourse/models/group').default;
if (this.get("loading")) { return; }
// we've reached the end
if (this.get("model.members.length") >= this.get("model.user_count")) { return; }

View File

@ -1,6 +1,4 @@
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, {
needs: ['user-invited-show'],
@ -109,6 +107,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
}.property('isPrivateTopic'),
groupFinder(term) {
const Group = require('discourse/models/group').default;
return Group.findAll({search: term, ignore_automatic: true});
},
@ -149,6 +148,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
actions: {
createInvite() {
const Invite = require('discourse/models/invite').default;
if (this.get('disabled')) { return; }
const groupNames = this.get('model.groupNames'),
@ -171,6 +172,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
},
generateInvitelink() {
const Invite = require('discourse/models/invite').default;
if (this.get('disabled')) { return; }
const groupNames = this.get('model.groupNames'),

View File

@ -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) {
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 = {};
// Topics might not be included