From 32d3c5e9047e262b40e201d5e47203892704c410 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 4 Oct 2022 02:27:45 +0200 Subject: [PATCH] insure that user context is present as posts can be queried without authentication --- backend/src/middleware/userInteractions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/middleware/userInteractions.js b/backend/src/middleware/userInteractions.js index 553aefe78..62e8e47f7 100644 --- a/backend/src/middleware/userInteractions.js +++ b/backend/src/middleware/userInteractions.js @@ -31,7 +31,7 @@ const setPostCounter = async (postId, relation, context) => { } const userClickedPost = async (resolve, root, args, context, info) => { - if (args.id) { + if (args.id && context.user) { await setPostCounter(args.id, 'CLICKED', context) } return resolve(root, args, context, info)