Merge pull request #2569 from lreeves/group-selector-datasource-finder
Move finder logic out of the group-selector component
This commit is contained in:
commit
b29b94046c
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ export default Discourse.ObjectController.extend(Discourse.ModalFunctionality, {
|
|||
}.property('model'),
|
||||
|
||||
/**
|
||||
Is Private Topic? (i.e. visible only to specific group members)
|
||||
Is Private Topic? (i.e. visible only to specific group members)
|
||||
|
||||
@property isPrivateTopic
|
||||
**/
|
||||
|
@ -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