diff --git a/app/controllers/post.js b/app/controllers/post.js index 1aef155..0e21148 100644 --- a/app/controllers/post.js +++ b/app/controllers/post.js @@ -397,8 +397,10 @@ class PostController extends SiteController { const { user: userService } = this.dtp.services; try { res.locals.pagination = this.getPaginationParameters(req, 20); - res.locals.authors = await userService.getAuthors(res.locals.pagination); - + + const {authors , totalAuthorCount }= await userService.getAuthors(res.locals.pagination); + res.locals.authors = authors; + res.locals.totalAuthorCount = totalAuthorCount; res.render('post/author/all'); } catch (error) { return next(error); diff --git a/app/services/user.js b/app/services/user.js index bac7b36..6a2a583 100644 --- a/app/services/user.js +++ b/app/services/user.js @@ -536,7 +536,9 @@ class UserService extends SiteService { .limit(pagination.cpp) .populate(this.populateUser) .lean(); - return authors; + const totalAuthorCount = await User.countDocuments( {'permissions.canAuthorPosts': true } ); + + return {authors, totalAuthorCount}; } async getUserProfile (userId) { diff --git a/app/views/post/author/all.pug b/app/views/post/author/all.pug index bf42039..15be7d8 100644 --- a/app/views/post/author/all.pug +++ b/app/views/post/author/all.pug @@ -13,4 +13,4 @@ block content li +renderAuthorCredit(author) .uk-card-footer - +renderPaginationBar(`/post/authors`, authors.length ) \ No newline at end of file + +renderPaginationBar(`/post/authors`, totalAuthorCount ) \ No newline at end of file