Revert "REFACTOR: support booting discourse with DISCOURSE_NO_CONSTANTS"

This reverts commit c0b277d273536f6aab1df67d908ed5e306868b2a.
This commit is contained in:
Robin Ward
2015-11-20 10:00:12 -05:00
parent 1c8b3c9447
commit c21457d6a7
99 changed files with 384 additions and 394 deletions

View File

@ -1,20 +1,17 @@
import { propertyNotEqual } from 'discourse/lib/computed';
import { popupAjaxError } from 'discourse/lib/ajax-error';
import ApiKey from 'admin/models/api-key';
import Group from 'discourse/models/group';
import TL3Requirements from 'admin/models/tl3-requirements';
const AdminUser = Discourse.User.extend({
customGroups: Em.computed.filter("groups", (g) => !g.automatic && Group.create(g)),
automaticGroups: Em.computed.filter("groups", (g) => g.automatic && Group.create(g)),
customGroups: Em.computed.filter("groups", (g) => !g.automatic && Discourse.Group.create(g)),
automaticGroups: Em.computed.filter("groups", (g) => g.automatic && Discourse.Group.create(g)),
generateApiKey() {
const self = this;
return Discourse.ajax("/admin/users/" + this.get('id') + "/generate_api_key", {
type: 'POST'
}).then(function (result) {
const apiKey = ApiKey.create(result.api_key);
const apiKey = Discourse.ApiKey.create(result.api_key);
self.set('api_key', apiKey);
return apiKey;
});
@ -380,7 +377,7 @@ const AdminUser = Discourse.User.extend({
}
}
}).catch(function() {
AdminUser.find( user.get('username') ).then(function(u){ user.setProperties(u); });
Discourse.AdminUser.find( user.get('username') ).then(function(u){ user.setProperties(u); });
bootbox.alert(I18n.t("admin.user.delete_failed"));
});
};
@ -453,7 +450,7 @@ const AdminUser = Discourse.User.extend({
if (user.get('loadedDetails')) { return Ember.RSVP.resolve(user); }
return AdminUser.find(user.get('username_lower')).then(function (result) {
return Discourse.AdminUser.find(user.get('username_lower')).then(function (result) {
user.setProperties(result);
user.set('loadedDetails', true);
});
@ -461,19 +458,19 @@ const AdminUser = Discourse.User.extend({
tl3Requirements: function() {
if (this.get('tl3_requirements')) {
return TL3Requirements.create(this.get('tl3_requirements'));
return Discourse.TL3Requirements.create(this.get('tl3_requirements'));
}
}.property('tl3_requirements'),
suspendedBy: function() {
if (this.get('suspended_by')) {
return AdminUser.create(this.get('suspended_by'));
return Discourse.AdminUser.create(this.get('suspended_by'));
}
}.property('suspended_by'),
approvedBy: function() {
if (this.get('approved_by')) {
return AdminUser.create(this.get('approved_by'));
return Discourse.AdminUser.create(this.get('approved_by'));
}
}.property('approved_by')
@ -514,7 +511,7 @@ AdminUser.reopenClass({
find(username) {
return Discourse.ajax("/admin/users/" + username + ".json").then(function (result) {
result.loadedDetails = true;
return AdminUser.create(result);
return Discourse.AdminUser.create(result);
});
},
@ -522,7 +519,7 @@ AdminUser.reopenClass({
return Discourse.ajax("/admin/users/list/" + query + ".json", {
data: filter
}).then(function(users) {
return users.map((u) => AdminUser.create(u));
return users.map((u) => Discourse.AdminUser.create(u));
});
}
});