mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 10:52:46 +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)=>{
|
app.get('/new/:id', asyncHandler(getBrew('share')), (req, res, next)=>{
|
||||||
sanitizeBrew(req.brew, 'share');
|
sanitizeBrew(req.brew, 'share');
|
||||||
splitTextStyleAndMetadata(req.brew);
|
splitTextStyleAndMetadata(req.brew);
|
||||||
req.brew.views = 0;
|
const brew = {
|
||||||
req.brew.title = `CLONE - ${req.brew.title}`;
|
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,
|
req.ogMeta = { ...defaultMetaTags,
|
||||||
title : 'New',
|
title : 'New',
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ const DEFAULT_BREW = {
|
|||||||
tags : [],
|
tags : [],
|
||||||
systems : [],
|
systems : [],
|
||||||
thumbnail : '',
|
thumbnail : '',
|
||||||
|
views : 0,
|
||||||
published : false,
|
published : false,
|
||||||
pageCount : 1,
|
pageCount : 1,
|
||||||
gDrive : false,
|
gDrive : false,
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ describe('Tests for api', ()=>{
|
|||||||
lastViewed : new Date(),
|
lastViewed : new Date(),
|
||||||
version : 1,
|
version : 1,
|
||||||
pageCount : 1,
|
pageCount : 1,
|
||||||
textBin : ''
|
textBin : '',
|
||||||
|
views : 0
|
||||||
};
|
};
|
||||||
googleBrew = {
|
googleBrew = {
|
||||||
...hbBrew,
|
...hbBrew,
|
||||||
@@ -261,7 +262,8 @@ If you believe you should have access to this brew, ask the file owner to invite
|
|||||||
gDrive : false,
|
gDrive : false,
|
||||||
style : undefined,
|
style : undefined,
|
||||||
trashed : false,
|
trashed : false,
|
||||||
updatedAt : undefined
|
updatedAt : undefined,
|
||||||
|
views : 0
|
||||||
});
|
});
|
||||||
expect(next).toHaveBeenCalled();
|
expect(next).toHaveBeenCalled();
|
||||||
expect(api.getId).toHaveBeenCalledWith(req);
|
expect(api.getId).toHaveBeenCalledWith(req);
|
||||||
@@ -452,7 +454,8 @@ brew`);
|
|||||||
thumbnail : '',
|
thumbnail : '',
|
||||||
title : 'asdf',
|
title : 'asdf',
|
||||||
trashed : false,
|
trashed : false,
|
||||||
updatedAt : undefined
|
updatedAt : undefined,
|
||||||
|
views : 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -510,7 +513,8 @@ brew`);
|
|||||||
thumbnail : '',
|
thumbnail : '',
|
||||||
title : 'asdf',
|
title : 'asdf',
|
||||||
trashed : false,
|
trashed : false,
|
||||||
updatedAt : undefined
|
updatedAt : undefined,
|
||||||
|
views : 0
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user