mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-04 10:22:38 +00:00
move email catching to api
This commit is contained in:
@@ -393,12 +393,9 @@ const VaultPage = (props) => {
|
|||||||
<span>{totalBrews}</span>
|
<span>{totalBrews}</span>
|
||||||
</span>
|
</span>
|
||||||
{brewCollection.map((brew, index) => {
|
{brewCollection.map((brew, index) => {
|
||||||
const processedAuthors = brew.authors.map(author =>
|
|
||||||
author.includes('@') ? 'hidden' : author
|
|
||||||
);
|
|
||||||
return (
|
return (
|
||||||
<BrewItem
|
<BrewItem
|
||||||
brew={{ ...brew, authors: processedAuthors }}
|
brew={{...brew}}
|
||||||
key={index}
|
key={index}
|
||||||
reportError={props.reportError}
|
reportError={props.reportError}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -68,11 +68,15 @@ const findBrews = async (req, res) => {
|
|||||||
.maxTimeMS(5000)
|
.maxTimeMS(5000)
|
||||||
.exec()
|
.exec()
|
||||||
.then((brews) => {
|
.then((brews) => {
|
||||||
console.log(
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||||
'Query in findBrews: ',
|
|
||||||
JSON.stringify(combinedQuery, null, 2)
|
const processedBrews = brews.map((brew) => {
|
||||||
);
|
brew.authors = brew.authors.map(author =>
|
||||||
res.json({ brews, page });
|
emailRegex.test(author) ? 'hidden' : author
|
||||||
|
);
|
||||||
|
return brew;
|
||||||
|
});
|
||||||
|
res.json({ brews: processedBrews, page });
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user