Merge pull request #2667 from Akuket/master

Patch admin search feature
This commit is contained in:
Lauri Ojansivu 2019-09-04 21:10:25 +03:00 committed by GitHub
commit ccfaf879dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View file

@ -17,7 +17,7 @@ BlazeComponent.extendComponent({
this.autorun(() => { this.autorun(() => {
const limit = this.page.get() * usersPerPage; const limit = this.page.get() * usersPerPage;
this.subscribe('people', limit, () => { this.subscribe('people', this.findUsersOptions.get(), limit, () => {
this.loadNextPageLocked = false; this.loadNextPageLocked = false;
const nextPeakBefore = this.callFirstWith(null, 'getNextPeak'); const nextPeakBefore = this.callFirstWith(null, 'getNextPeak');
this.calculateNextPeak(); this.calculateNextPeak();
@ -85,7 +85,7 @@ BlazeComponent.extendComponent({
const users = Users.find(this.findUsersOptions.get(), { const users = Users.find(this.findUsersOptions.get(), {
fields: { _id: true }, fields: { _id: true },
}); });
this.number.set(users.count()); this.number.set(users.count(false));
return users; return users;
}, },
peopleNumber() { peopleNumber() {

View file

@ -1,4 +1,5 @@
Meteor.publish('people', function(limit) { Meteor.publish('people', function(query, limit) {
check(query, Match.OneOf(Object, null));
check(limit, Number); check(limit, Number);
if (!Match.test(this.userId, String)) { if (!Match.test(this.userId, String)) {
@ -8,7 +9,7 @@ Meteor.publish('people', function(limit) {
const user = Users.findOne(this.userId); const user = Users.findOne(this.userId);
if (user && user.isAdmin) { if (user && user.isAdmin) {
return Users.find( return Users.find(
{}, query,
{ {
limit, limit,
sort: { createdAt: -1 }, sort: { createdAt: -1 },
@ -21,9 +22,8 @@ Meteor.publish('people', function(limit) {
loginDisabled: 1, loginDisabled: 1,
authenticationMethod: 1, authenticationMethod: 1,
}, },
}, });
);
} else {
return [];
} }
return [];
}); });