mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 05:23:43 +08:00
Return a promise from Discourse.Group.findAll()
This commit is contained in:
parent
003eb06807
commit
bd0c2a74fc
|
@ -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);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -122,15 +122,13 @@ Discourse.Group = Discourse.Model.extend({
|
|||
|
||||
Discourse.Group.reopenClass({
|
||||
findAll: function(){
|
||||
var list = Discourse.SelectableArray.create();
|
||||
|
||||
Discourse.ajax("/admin/groups.json").then(function(groups){
|
||||
return Discourse.ajax("/admin/groups.json").then(function(groups){
|
||||
var list = Discourse.SelectableArray.create();
|
||||
_.each(groups,function(group){
|
||||
list.addObject(Discourse.Group.create(group));
|
||||
});
|
||||
return list;
|
||||
});
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
aliasLevelOptions: function() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user