summaryrefslogtreecommitdiffstats
path: root/client/components/settings/peopleBody.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/components/settings/peopleBody.js')
-rw-r--r--client/components/settings/peopleBody.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index a4d70974..245c8884 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -8,6 +8,7 @@ BlazeComponent.extendComponent({
this.error = new ReactiveVar('');
this.loading = new ReactiveVar(false);
this.people = new ReactiveVar(true);
+ this.findUsersOptions = new ReactiveVar({});
this.page = new ReactiveVar(1);
this.loadNextPageLocked = false;
@@ -26,6 +27,25 @@ BlazeComponent.extendComponent({
});
});
},
+ events() {
+ return [{
+ 'click #searchButton'(event) {
+ const value = $('#searchInput').first().val();
+ if (value === '') {
+ this.findUsersOptions.set({});
+ } else {
+ const regex = new RegExp(value, 'i');
+ this.findUsersOptions.set({
+ $or: [
+ { username: regex },
+ { 'profile.fullname': regex },
+ { 'emails.address': regex },
+ ]
+ });
+ }
+ }
+ }];
+ },
loadNextPage() {
if (this.loadNextPageLocked === false) {
this.page.set(this.page.get() + 1);
@@ -49,7 +69,8 @@ BlazeComponent.extendComponent({
this.loading.set(w);
},
peopleList() {
- return Users.find({}, {
+ // get users in front to cache them
+ return Users.find(this.findUsersOptions.get(), {
fields: {_id: true},
});
},