mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-08 03:12:40 +00:00
Maximum title length set to 100 characters.
This commit is contained in:
@@ -11,9 +11,15 @@ const Markdown = require('../shared/naturalcrit/markdown.js');
|
|||||||
// });
|
// });
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
const MAX_TITLE_LENGTH = 100;
|
||||||
|
|
||||||
const getGoodBrewTitle = (text)=>{
|
const getGoodBrewTitle = (text)=>{
|
||||||
const tokens = Markdown.marked.lexer(text);
|
const tokens = Markdown.marked.lexer(text);
|
||||||
return title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text;
|
let title = (tokens.find((token)=>token.type == 'heading' || token.type == 'paragraph') || { text: 'No Title' }).text;
|
||||||
|
if(title.length > MAX_TITLE_LENGTH) {
|
||||||
|
title = title.substr(0, MAX_TITLE_LENGTH);
|
||||||
|
}
|
||||||
|
return title;
|
||||||
};
|
};
|
||||||
|
|
||||||
const newBrew = (req, res)=>{
|
const newBrew = (req, res)=>{
|
||||||
@@ -122,8 +128,6 @@ const newGoogleBrew = async (req, res, next)=>{
|
|||||||
|
|
||||||
req.body = brew;
|
req.body = brew;
|
||||||
|
|
||||||
console.log(oAuth2Client);
|
|
||||||
|
|
||||||
const newBrew = await GoogleActions.newGoogleBrew(oAuth2Client, brew);
|
const newBrew = await GoogleActions.newGoogleBrew(oAuth2Client, brew);
|
||||||
|
|
||||||
return res.status(200).send(newBrew);
|
return res.status(200).send(newBrew);
|
||||||
|
|||||||
Reference in New Issue
Block a user