0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 22:52:40 +00:00

Move userpage brew data clean up to app.js

This commit is contained in:
Sean Robertson
2023-09-06 11:52:28 +12:00
parent a30c2fa1f7
commit 3e43b058a5
2 changed files with 3 additions and 1 deletions

View File

@@ -28,7 +28,6 @@ const UserPage = createClass({
const usernameWithS = this.props.username + (this.props.username.endsWith('s') ? `` : `s`);
const brews = _.groupBy(this.props.brews, (brew)=>{
brew.title = brew.title.trim();
return (brew.published ? 'published' : 'private');
});

View File

@@ -268,6 +268,9 @@ app.get('/user/:username', async (req, res, next)=>{
}
req.brews = _.map(brews, (brew)=>{
// Clean up brew data
brew.title = brew.title?.trim();
brew.description = brew.description?.trim();
return sanitizeBrew(brew, ownAccount ? 'edit' : 'share');
});