0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00

Use DEFAULT_BREW values instead of setting them here

This commit is contained in:
Trevor Buckner
2023-01-30 17:08:19 -05:00
parent 541109e7b1
commit f628e1a5ae
2 changed files with 10 additions and 7 deletions

View File

@@ -294,13 +294,15 @@ app.get('/edit/:id', asyncHandler(getBrew('edit')), (req, res, next)=>{
app.get('/new/:id', asyncHandler(getBrew('share')), (req, res, next)=>{
sanitizeBrew(req.brew, 'share');
splitTextStyleAndMetadata(req.brew);
req.brew.published = false;
req.brew.createdAt = clock.now;
req.brew.updatedAt = clock.now;
req.brew.views = 1;
req.brew.lastViewed = clock.now;
req.brew.title = `CLONE - ${req.brew.title}`;
const brew = {
shareId : req.brew.shareId,
title : `CLONE - ${req.brew.title}`,
text : req.brew.text,
style : req.brew.style,
renderer : req.brew.renderer,
theme : req.brew.theme
};
req.brew = _.defaults(brew, DEFAULT_BREW);
req.ogMeta = { ...defaultMetaTags,
title : 'New',