From ee05d577636b80ff58906b9de44f147484fd459e Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 30 Oct 2018 20:49:12 +0100 Subject: Fixed user id duplicated output --- src/hooks/process-post.js | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/hooks/process-post.js') diff --git a/src/hooks/process-post.js b/src/hooks/process-post.js index 553bb59..70e8397 100644 --- a/src/hooks/process-post.js +++ b/src/hooks/process-post.js @@ -6,28 +6,20 @@ module.exports = function (options = {}) { return async context => { const {data} = context; - // Throw an error if we didn't get a text if (!data.text) { throw new Error('A post must have a text'); } - // The authenticated user const user = context.params.user; - // The actual message text const text = context.data.text - // Posts can't be longer than 400 characters .substring(0, 400); - // Override the original data (so that people can't submit additional stuff) context.data = { text, - // Set the user id userId: user.id, - // Add the current date createdAt: new Date().getTime() }; - // Best practise, hooks should always return the context return context; }; }; -- cgit v1.2.3