Return a promise from Discourse.Group.findAll()

This commit is contained in:
Robin Ward
2014-02-06 14:37:08 -05:00
parent 003eb06807
commit bd0c2a74fc
2 changed files with 7 additions and 8 deletions

View File

@@ -1,6 +1,5 @@
Discourse.AdminGroupsController = Ember.Controller.extend({
itemController: 'adminGroup',
aliasLevels: null,
actions: {
edit: function(group){
@@ -13,8 +12,10 @@ Discourse.AdminGroupsController = Ember.Controller.extend({
self.set('refreshingAutoGroups', true);
Discourse.ajax('/admin/groups/refresh_automatic_groups', {type: 'POST'}).then(function() {
self.set('model', Discourse.Group.findAll());
self.set('refreshingAutoGroups', false);
return Discourse.Group.findAll().then(function(groups) {
self.set('model', groups);
self.set('refreshingAutoGroups', false);
});
});
},