From 57ae7c409105c75d64e9c2eb91bff6221d5f5ff7 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 2 Mar 2023 16:04:17 -0600 Subject: [PATCH] Fix in postController --- app/controllers/post.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/post.js b/app/controllers/post.js index bcd7c9b..9d1b587 100644 --- a/app/controllers/post.js +++ b/app/controllers/post.js @@ -343,9 +343,9 @@ class PostController extends SiteController { throw new SiteError(403, 'The post is not published'); } } - - await resourceService.recordView(req, 'Post', res.locals.post._id); - + if (res.locals.post.status === 'published') { + await resourceService.recordView(req, 'Post', res.locals.post._id); + } res.locals.countPerPage = 20; res.locals.pagination = this.getPaginationParameters(req, res.locals.countPerPage);