This moves the finder logic out of the component
This commit is contained in:
parent
dffe528400
commit
9c2f4b55ac
|
@ -34,8 +34,8 @@ export default Em.Component.extend({
|
|||
return g.name;
|
||||
},
|
||||
dataSource: function(term) {
|
||||
// TODO: Components should definitely not perform queries
|
||||
return Discourse.Group.findAll({search: term, ignore_automatic: true}).then(function(groups){
|
||||
return self.get("groupFinder")(term).then(function(groups){
|
||||
|
||||
if(!selectedGroups){
|
||||
return groups;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,13 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
|||
}
|
||||
}.property('isPrivateTopic'),
|
||||
|
||||
/**
|
||||
Function to find groups.
|
||||
**/
|
||||
groupFinder: function(term) {
|
||||
return Discourse.Group.findAll({search: term, ignore_automatic: true});
|
||||
},
|
||||
|
||||
/**
|
||||
The "success" text for when the invite was created.
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{{#if isAdmin}}
|
||||
<label>{{{groupInstructions}}}</label>
|
||||
{{group-selector includeAuto=false groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||
{{group-selector includeAuto=false groupFinder=groupFinder groupNames=groupNames placeholderKey="topic.invite_private.group_name"}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue