mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Navigating to a user's admin page would not populate
`availableGroups`
This commit is contained in:
parent
27f786e06a
commit
c8a0bf35c5
3 changed files with 19 additions and 35 deletions
|
@ -1,14 +1,3 @@
|
|||
/**
|
||||
The top-level controller for user pages in admin.
|
||||
Ember assertion says that this class needs to be defined even if it's empty.
|
||||
|
||||
@class AdminUserController
|
||||
@extends Discourse.ObjectController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserController = Discourse.ObjectController.extend({});
|
||||
|
||||
/**
|
||||
A controller related to viewing a user in the admin section
|
||||
|
||||
|
@ -19,6 +8,8 @@ Discourse.AdminUserController = Discourse.ObjectController.extend({});
|
|||
**/
|
||||
Discourse.AdminUserIndexController = Discourse.ObjectController.extend({
|
||||
editingTitle: false,
|
||||
originalPrimaryGroupId: null,
|
||||
availableGroups: null,
|
||||
|
||||
showApproval: Discourse.computed.setting('must_approve_users'),
|
||||
showBadges: Discourse.computed.setting('enable_badges'),
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
/**
|
||||
Handles routes related to users in the admin section.
|
||||
|
||||
@class AdminUserRoute
|
||||
@extends Discourse.Route
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.AdminUserRoute = Discourse.Route.extend({
|
||||
|
||||
serialize: function(model) {
|
||||
return { username: model.get('username').toLowerCase() };
|
||||
},
|
||||
|
@ -21,22 +12,30 @@ Discourse.AdminUserRoute = Discourse.Route.extend({
|
|||
},
|
||||
|
||||
afterModel: function(adminUser) {
|
||||
var controller = this.controllerFor('adminUser');
|
||||
|
||||
Discourse.Group.findAll().then(function(groups){
|
||||
controller.set("availableGroups", groups.filterBy("automatic", false));
|
||||
}.bind(this));
|
||||
|
||||
|
||||
return adminUser.loadDetails().then(function () {
|
||||
adminUser.setOriginalTrustLevel();
|
||||
controller.set('model', adminUser);
|
||||
return adminUser;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Discourse.AdminUserIndexRoute = Discourse.Route.extend({
|
||||
model: function() {
|
||||
return this.modelFor('adminUser');
|
||||
},
|
||||
|
||||
afterModel: function(model) {
|
||||
var self = this;
|
||||
return Discourse.Group.findAll().then(function(groups){
|
||||
self._availableGroups = groups.filterBy('automatic', false);
|
||||
return model;
|
||||
});
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.setProperties({
|
||||
originalPrimaryGroupId: model.get('primary_group_id'),
|
||||
availableGroups: this._availableGroups,
|
||||
model: model
|
||||
});
|
||||
},
|
||||
|
@ -47,11 +46,4 @@ Discourse.AdminUserRoute = Discourse.Route.extend({
|
|||
this.controllerFor('modal').set('modalClass', 'suspend-user-modal');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Discourse.AdminUserIndexRoute = Discourse.Route.extend({
|
||||
setupController: function(c) {
|
||||
c.set('model', this.controllerFor('adminUser').get('model'));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ var ApplicationRoute = Em.Route.extend({
|
|||
}
|
||||
|
||||
var exceptionController = this.controllerFor('exception');
|
||||
Em.warn(err);
|
||||
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
||||
|
||||
this.intermediateTransitionTo('exception');
|
||||
|
|
Loading…
Reference in a new issue