0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-14 19:22:52 +00:00

Merge pull request #1453 from G-Ambatte/modifyTitleOfClonedBrew

Prepend 'CLONE:- ' to title of cloned brew
This commit is contained in:
Trevor Buckner
2021-07-30 17:30:26 -04:00
committed by GitHub
2 changed files with 6 additions and 6 deletions

View File

@@ -69,16 +69,15 @@ const NewPage = createClass({
const brewStorage = localStorage.getItem(BREWKEY); const brewStorage = localStorage.getItem(BREWKEY);
const styleStorage = localStorage.getItem(STYLEKEY); const styleStorage = localStorage.getItem(STYLEKEY);
const brew = this.state.brew;
if(!this.props.brew.text || !this.props.brew.style){ if(!this.props.brew.text || !this.props.brew.style){
this.setState({ brew.text = this.props.brew.text || (brewStorage ?? '');
brew : { brew.style = this.props.brew.style || (styleStorage ?? undefined);
text : this.props.brew.text || (brewStorage ?? ''),
style : this.props.brew.style || (styleStorage ?? undefined)
}
});
} }
this.setState((prevState)=>({ this.setState((prevState)=>({
brew : brew,
htmlErrors : Markdown.validate(prevState.brew.text) htmlErrors : Markdown.validate(prevState.brew.text)
})); }));

View File

@@ -170,6 +170,7 @@ app.get('/edit/:id', asyncHandler(async (req, res, next)=>{
//New Page //New Page
app.get('/new/:id', asyncHandler(async (req, res, next)=>{ app.get('/new/:id', asyncHandler(async (req, res, next)=>{
const brew = await getBrewFromId(req.params.id, 'share'); const brew = await getBrewFromId(req.params.id, 'share');
brew.title = `CLONE - ${brew.title}`;
req.brew = brew; req.brew = brew;
return next(); return next();
})); }));