mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-28 04:52:40 +00:00
Merge pull request #2651 from 5e-Cleric/cloning-fix-2
Thanks @5e-Cleric for this fix!
This commit is contained in:
@@ -294,8 +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.views = 0;
|
||||
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',
|
||||
|
||||
@@ -16,6 +16,7 @@ const DEFAULT_BREW = {
|
||||
tags : [],
|
||||
systems : [],
|
||||
thumbnail : '',
|
||||
views : 0,
|
||||
published : false,
|
||||
pageCount : 1,
|
||||
gDrive : false,
|
||||
|
||||
@@ -71,7 +71,8 @@ describe('Tests for api', ()=>{
|
||||
lastViewed : new Date(),
|
||||
version : 1,
|
||||
pageCount : 1,
|
||||
textBin : ''
|
||||
textBin : '',
|
||||
views : 0
|
||||
};
|
||||
googleBrew = {
|
||||
...hbBrew,
|
||||
@@ -261,7 +262,8 @@ If you believe you should have access to this brew, ask the file owner to invite
|
||||
gDrive : false,
|
||||
style : undefined,
|
||||
trashed : false,
|
||||
updatedAt : undefined
|
||||
updatedAt : undefined,
|
||||
views : 0
|
||||
});
|
||||
expect(next).toHaveBeenCalled();
|
||||
expect(api.getId).toHaveBeenCalledWith(req);
|
||||
@@ -452,7 +454,8 @@ brew`);
|
||||
thumbnail : '',
|
||||
title : 'asdf',
|
||||
trashed : false,
|
||||
updatedAt : undefined
|
||||
updatedAt : undefined,
|
||||
views : 0
|
||||
});
|
||||
});
|
||||
|
||||
@@ -510,7 +513,8 @@ brew`);
|
||||
thumbnail : '',
|
||||
title : 'asdf',
|
||||
trashed : false,
|
||||
updatedAt : undefined
|
||||
updatedAt : undefined,
|
||||
views : 0
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user