From ed3e343e0eacd3715e187ed4a9e539ec01b75bb5 Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 24 Jun 2020 12:58:00 +0100 Subject: [PATCH] validate posts must contain at least one paragraph/image/video --- services/gunDB/contact-api/actions.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index f83a8616..4a8bfcf5 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -1255,6 +1255,10 @@ const setLastSeenApp = () => * @returns {Promise} */ const createPost = async (tags, title, content) => { + if (content.length === 0) { + throw new Error(`A post must contain at least one paragraph/image/video`) + } + const user = require('../Mediator').getUser() const wall = user.get(Key.WALL) const pages = wall.get(Key.PAGES)