allow notes to be overwritten

This commit is contained in:
Sam Wing 2019-11-16 22:50:34 -05:00
parent 004dfe44ec
commit 285979d777

View file

@ -177,14 +177,9 @@ module.exports = (db) => {
req.flash('error', 'Invalid user'); req.flash('error', 'Invalid user');
return res.redirect(`/wishlist/${req.params.user}`); return res.redirect(`/wishlist/${req.params.user}`);
} }
if (wishlistItem.note) {
req.flash('error', 'Already has a note');
return res.redirect(`/wishlist/${req.params.user}`);
} else {
wishlistItem.note = req.body.note; wishlistItem.note = req.body.note;
wishlist[i] = wishlistItem; wishlist[i] = wishlistItem;
} }
}
doc.wishlist = wishlist; doc.wishlist = wishlist;
await db.put(doc); await db.put(doc);
req.flash('success', 'Successfully added note!'); req.flash('success', 'Successfully added note!');